initial stab at the option
This commit is contained in:
@@ -520,7 +520,11 @@ DeepState_RunSavedTestCase(struct DeepState_TestInfo *test, const char *dir,
|
||||
if (path == NULL) {
|
||||
DeepState_Abandon("Error allocating memory");
|
||||
}
|
||||
snprintf(path, path_len, "%s/%s", dir, name);
|
||||
if (strncmp(dir, "", strlen(dir)) != 0) {
|
||||
snprintf(path, path_len, "%s/%s", dir, name);
|
||||
} else {
|
||||
snprintf(path, path_len, "%s", name);
|
||||
}
|
||||
|
||||
DeepState_InitInputFromFile(path);
|
||||
|
||||
@@ -587,11 +591,8 @@ static int DeepState_RunSavedCasesForTest(struct DeepState_TestInfo *test) {
|
||||
return num_failed_tests;
|
||||
}
|
||||
|
||||
/* Run tests with saved input from `FLAGS_input_test_dir`.
|
||||
*
|
||||
* For each test unit and case, see if there are input files in the
|
||||
* expected directories. If so, use them to initialize
|
||||
* `DeepState_Input`, then run the test. If not, skip the test. */
|
||||
/* Run test from `FLAGS_input_test_file`, under `FLAGS_input_which_test`
|
||||
* or first test, if not defined. */
|
||||
static int DeepState_RunSingleSavedTestCase(void) {
|
||||
int num_failed_tests = 0;
|
||||
struct DeepState_TestInfo *test = NULL;
|
||||
@@ -599,7 +600,20 @@ static int DeepState_RunSingleSavedTestCase(void) {
|
||||
DeepState_Setup();
|
||||
|
||||
for (test = DeepState_FirstTest(); test != NULL; test = test->prev) {
|
||||
num_failed_tests += DeepState_RunSavedCasesForTest(test);
|
||||
if (HAS_FLAG_input_which_test) {
|
||||
if (strncmp(FLAGS_input_which_test, test->test_name, strlen(FLAGS_input_which_test)) == 0) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
enum DeepState_TestRunResult result =
|
||||
DeepState_RunSavedTestCase(test, "", FLAGS_input_test_file);
|
||||
|
||||
if (result != DeepState_TestRunPass) {
|
||||
num_failed_tests++;
|
||||
}
|
||||
|
||||
DeepState_Teardown();
|
||||
|
||||
Reference in New Issue
Block a user