Skip to content

Commit

Permalink
Merge pull request #258 from lattice/feature/gtest_options
Browse files Browse the repository at this point in the history
Feature/gtest options
  • Loading branch information
maddyscientist committed May 27, 2015
2 parents 5f41ea2 + 4f70d56 commit 20543fa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
12 changes: 8 additions & 4 deletions tests/dslash_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,10 @@ TEST(dslash, verify) {

int main(int argc, char **argv)
{

// initalize google test, includes command line options
::testing::InitGoogleTest(&argc, argv);
// return code for google test
int test_rc = 0;
for (int i =1;i < argc; i++){
if(process_command_line_option(argc, argv, &i) == 0){
continue;
Expand Down Expand Up @@ -940,13 +943,14 @@ int main(int argc, char **argv)
} else {
printfQuda("Result: CPU = %f, CPU-QUDA = %f\n", norm2_cpu, norm2_cpu_cuda);
}

if (verify_results) {
::testing::InitGoogleTest(&argc, argv);
if (RUN_ALL_TESTS() != 0) warningQuda("Tests failed");
test_rc = RUN_ALL_TESTS();
if (test_rc != 0) warningQuda("Tests failed");
}
}
end();

finalizeComms();
return test_rc;
}
27 changes: 12 additions & 15 deletions tests/staggered_dslash_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,10 @@ TEST(dslash, verify) {
ASSERT_LE(deviation, tol) << "CPU and CUDA implementations do not agree";
}

static int dslashTest(int argc, char **argv)
static int dslashTest()
{
int accuracy_level = 0;

// return code for google test
int test_rc = 0;
init();

int attempts = 1;
Expand Down Expand Up @@ -469,15 +469,15 @@ static int dslashTest(int argc, char **argv)
} else {
printfQuda("Result: CPU = %f, CPU-QUDA = %f\n", norm2_cpu, norm2_cpu_cuda);
}

if (verify_results) {
::testing::InitGoogleTest(&argc, argv);
if (RUN_ALL_TESTS() != 0) warningQuda("Tests failed");
test_rc = RUN_ALL_TESTS();
if (test_rc != 0) warningQuda("Tests failed");
}
}
end();

return accuracy_level;
return test_rc;
}


Expand Down Expand Up @@ -513,7 +513,8 @@ usage_extra(char** argv )

int main(int argc, char **argv)
{

// initalize google test
::testing::InitGoogleTest(&argc, argv);
int i;
for (i =1;i < argc; i++){

Expand All @@ -529,15 +530,11 @@ int main(int argc, char **argv)

display_test_info();

int ret =1;
int accuracy_level = dslashTest(argc, argv);

printfQuda("accuracy_level =%d\n", accuracy_level);

if (accuracy_level >= 1) ret = 0; //probably no error, -1 means no matching
// return result of RUN_ALL_TESTS
int test_rc = dslashTest();

finalizeComms();

return ret;
return test_rc;
}

0 comments on commit 20543fa

Please sign in to comment.