Skip to content

Commit

Permalink
Add SST-Info interactive test, quit command (#1104)
Browse files Browse the repository at this point in the history
  • Loading branch information
bliu1013 authored Jul 17, 2024
1 parent 0350185 commit a62f11c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/sst/core/sstinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ parseInput(std::string input)
"- Help : Displays this help message\n"
"- List {element.subelement} : Displays element libraries and component information\n"
"- Find {field} {search string} : Displays all components with the given search string in its field\n\n"
"- Quit : Exits the program\n\n"
"To see more detailed instructions, type in a command without additional parameters.\n\n";
}
else if ( command == "list" ) {
Expand Down Expand Up @@ -260,6 +261,9 @@ parseInput(std::string input)
"find CATEGORY UNCATEGORIZED\n"
"find parameters rng";
}
else if ( command == "quit" ) {
return command;
}
else {
text = getErrorText(command);
}
Expand Down Expand Up @@ -1118,8 +1122,10 @@ InteractiveWindow::getInput()
if ( input != "" ) {
g_prevInput.push_front(input);
output = parseInput(input);
setInfoText(output);

if ( output == "quit" ) { break; }

setInfoText(output);
g_window.draw();
g_window.printInfo();
input = "";
Expand Down Expand Up @@ -1188,6 +1194,7 @@ InteractiveWindow::getInput()
// Make sure the cursor resets to the correct place
g_window.resetCursor(input.size() + 1);
}
endwin();
}

void
Expand Down
1 change: 1 addition & 0 deletions src/sst/core/testingframework/sst_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import sys
import os
import platform
import unittest
import threading
import time
Expand Down
14 changes: 10 additions & 4 deletions tests/testsuite_default_sstinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ def tearDown(self):
#####

def test_sstinfo_coretestelement(self):
self.sstinfo_test_template("coreTestElement")
self.sstinfo_test_template("coreTestElement", "-q")

def test_sstinfo_interactive(self):
self.sstinfo_test_template("interactive", "-i")

#####

def sstinfo_test_template(self, testtype):
def sstinfo_test_template(self, testtype, flags):
testsuitedir = self.get_testsuite_dir()
outdir = test_output_get_run_dir()

Expand All @@ -67,9 +70,12 @@ def sstinfo_test_template(self, testtype):
err_str = "Path to SST-INFO {0}; does not exist...".format(sst_app_path)
self.assertTrue(os.path.isdir(sst_app_path), err_str)

cmd = '{0}/sst-info -q {1}'.format(sst_app_path, testtype)
if platform.system() == "Linux":
cmd = 'timeout 1 {0}/sst-info coreTestElement {1}'.format(sst_app_path, flags)
else:
cmd = "perl -e 'alarm shift; exec @ARGV' 1 {0}/sst-info coreTestElement {1}".format(sst_app_path, flags)
rtn = OSCommand(cmd, output_file_path = outfile, error_file_path = errfile).run()
if rtn.result() != 0:
if rtn.result() != (0 or 124):
self.assertEquals(rtn.result(), 0, "sst-info Test failed running cmdline {0} - return = {1}".format(cmd, rtn.result()))
with open(outfile, 'r') as f:
log_failure("FAILURE: sst-info cmdline {0}; output =\n{1}".format(cmd, f.read()))
Expand Down

0 comments on commit a62f11c

Please sign in to comment.