mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-08 13:01:52 +00:00
f8ceb54f5e
Adds sm_api_single (run SM_API tests by name), prog_test summary in run_tests.sh, and records toolchain, build time, stubs and the test baseline (SM_API 112 pass + 2 stubbed, prog_test 17/17 suites pass). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
54 lines
1.7 KiB
Plaintext
54 lines
1.7 KiB
Plaintext
// 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 <cstdio>
|
|
#include <cstring>
|
|
|
|
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 | <TestName>...\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;
|
|
}
|