New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: refactor/simplify test management #495
base: main
Are you sure you want to change the base?
Conversation
ad28ae3
to
f8c3dbc
Compare
framework/sandstone.cpp
Outdated
@@ -3181,6 +3211,8 @@ int main(int argc, char **argv) | |||
const char *on_crash_arg = nullptr; | |||
|
|||
// test selection | |||
std::vector<char *> enabled_tests; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const char *
or std::string_view
framework/sandstone.cpp
Outdated
case disable_option: | ||
disable_tests(test_set, optarg); | ||
disabled_tests.push_back(optarg); | ||
break; | ||
case 'e': | ||
add_tests(test_set, test_list, optarg); | ||
enabled_tests.push_back(optarg); | ||
test_selection_strategy = Ordered; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I've been meaning to do this for a while.
framework/sandstone.cpp
Outdated
} else { | ||
/* otherwise, start with all the applicable tests (self tests or | ||
* regular. */ | ||
test_set = new SandstoneTestSet((sApp->shmem->selftest) ? SandstoneTestSet::SELF_TESTS : SandstoneTestSet::REGULAR_TESTS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds redundant with the init
call above. Any way to simplify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
init
creates a catalog of all known tests, constructor is used to creates a instance which contains the tests to be run in this execution of opendcdiag. That's the difference. The reason it's not simply boolean in the constructor is that we need to start with an empty set at times (e.g. when -e
is specified on the command line).
framework/sandstone.cpp
Outdated
@@ -3246,6 +3278,7 @@ int main(int argc, char **argv) | |||
case 'l': | |||
case raw_list_tests: | |||
case raw_list_groups: | |||
test_set = new SandstoneTestSet(SandstoneTestSet::REGULAR_TESTS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means we can't list the selftests. Please don't remove that ability.
framework/sandstone.cpp
Outdated
// If we want to use the weighted testrunner we need to initialize it | ||
if (test_list_file_path) { | ||
if (builtin_test_list_name) | ||
logging_printf(LOG_LEVEL_QUIET, | ||
"# WARNING: both --test-list-file and --use-builtin-test-list " | ||
"specified, using test file \"%s\".\n", test_list_file_path); | ||
if (test_list.size()) { | ||
logging_printf(LOG_LEVEL_QUIET, | ||
"# WARNING: both --test-list-file and --enable specified, using only " | ||
"the test list file \"%s\".\n", test_list_file_path); | ||
test_list = {}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be above the enable/disable code above?
framework/sandstone_tests.cpp
Outdated
static std::map<const char *, struct test *, SandstoneTestSet::cstr_cmp> all_test_map; /* maps test name to test */ | ||
static std::map<const char *, std::vector <struct test *>> all_group_map; /* maps group name to a vector of tests it contains */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use std::map
globals (they have an init function). Move these to inside SandstoneApplication
.
Use std::string_view
as the key type instead of const char *
, so you don't have to have cstr_cmp
.
framework/sandstone_tests.cpp
Outdated
case SELF_TESTS: | ||
known_tests = selftests; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#ifndef
for no-self-tests
framework/sandstone_tests.cpp
Outdated
try { | ||
struct test *t = all_test_map.at(name); | ||
res.push_back(t); | ||
} catch(const std::out_of_range &e) { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use the exception-throwing lookup. Use find
instead.
b94a4da
to
bb448d6
Compare
f19f6b2
to
be87b1f
Compare
c0ac468
to
941e025
Compare
553ad70
to
6e99b43
Compare
605be56
to
32e82de
Compare
The framework is broken, but clean of what we will be getting rid of. Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
This is to support --test-list-randomize and various timing options when OpenDCDiag cycles through the list. Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
Instead of reinitializing SMI counts every "loop" of the test, it's done after smi_count test has been run (in its clean up). Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
Previously it was not "injected" at the very end if there were failured, but it was injected inbetween regardless. With the new implementation it is consistently run at the end of each iteration. Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
The mce_test (mce_check) is now added to the end of the test_set. The logic of SandstoneTestSet will keep it last on the list. It will be therefore run each iteration. Code that resets the count on new iteration as well as printing of the header is moved to the iterator instead of main cycle. Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
selftest_sigkill is not a valid test name on Windows. After the refactoring opendcdiag.exe produces an empty output when an illegal test name is specified. Before it was not touching the log file, but the test was failing cause it was reading the output.yaml of the previous run (note the loop over tests). Also, make the output file unique. Signed-off-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
32e82de
to
2fe7042
Compare
This PR replaces entire test_selector infrastructure to pick the next test. It separates the functionality of providing the next test to run into
SandstoneTestSet
class whose only contract is to respond to the question "what is the next test to run?". For this purpose, it provides an iterator which is used by opendcdiag to cycle through the tests. It ensures a cleaner interface to configure and run the tests. It also simplifies greatly the complexity and maintainability of the implementation. The behavior of the iterator is configurable to provide:This keeps it compatible with the previous implementation.
Additionally,
mce_check
test is removed from the main cycle and is encapsulated in the iterator instead.--disable
option as opposed to editing the test list file needed before.