// solidcore harness driver (not upstream code). Generated by CMake from // harness/cpp/stubs/sm_api_single_main.cpp.in; the test list is scraped from // the "stat = Test...();" calls in upstream/tests/SM_API_test/src/SM_API_test.cpp. // // Runs selected SM_API tests by name (upstream SM_API_test_app has no // per-test selection): // sm_api_single --list // sm_api_single TestSmBoolean [TestSmCreateBox ...] // Exit status 0 when every selected test returns SM_SUCCESS. #include "StdAfx.h" #include "SM_API_test.h" #include "SmApiGeneral.h" #include #include namespace { struct Entry { const char* name; SmStatus (*fn)(); }; const Entry kTests[] = { @SC_TEST_TABLE@ }; } // namespace int main(int argc, char* argv[]) { if (argc < 2) { std::printf("usage: %s --list | ...\n", argv[0]); return 2; } if (std::strcmp(argv[1], "--list") == 0) { for (const Entry& e : kTests) std::printf("%s\n", e.name); return 0; } // Same global settings as run_sm_api(FALSE) in SM_API_test.cpp. smSet_DoGraphics(FALSE); smSet_OutputLong(FALSE); smSet_OutputThin(FALSE); smSet_OutputDebugLog(FALSE); smSet_OutputApiLog(FALSE); int failed = 0; for (int i = 1; i < argc; ++i) { const Entry* hit = nullptr; for (const Entry& e : kTests) if (std::strcmp(e.name, argv[i]) == 0) { hit = &e; break; } if (!hit) { std::printf("unknown test: %s\n", argv[i]); return 2; } SmStatus st = hit->fn(); std::printf("%s: %s (status %ld)\n", hit->name, st == SM_SUCCESS ? "PASS" : "FAIL", (long)st); std::fflush(stdout); if (st != SM_SUCCESS) ++failed; } return failed == 0 ? 0 : 1; }