mirror of
https://github.com/xemu-project/nxdk_pgraph_tests.git
synced 2024-11-26 19:40:45 +00:00
Makes it easier to disable tests in release build.
This commit is contained in:
parent
371efb308a
commit
00a4ebe87f
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -36,14 +36,14 @@ jobs:
|
||||
- name: Compile
|
||||
run: |
|
||||
cd nxdk_pgraph_tests
|
||||
make -j $(grep -c processor /proc/cpuinfo)
|
||||
make -j $(grep -c processor /proc/cpuinfo) ENABLE_PROGRESS_LOG=y RUNTIME_CONFIG_PATH="e:/nxdk_pgraph_tests/pgraph_tests.cnf" DUMP_CONFIG_FILE=y
|
||||
- name: Create release
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: "marvinpinto/action-automatic-releases@latest"
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: "latest"
|
||||
prerelease: true
|
||||
prerelease: false
|
||||
title: "xiso containing pgraph tests"
|
||||
files: |
|
||||
nxdk_pgraph_tests/nxdk_pgraph_tests.iso
|
||||
|
14
README.md
14
README.md
@ -34,6 +34,20 @@ ThisTestSuiteIsEnabled
|
||||
# This is ignored.
|
||||
```
|
||||
|
||||
In the default release build, the test suite will look for this file in
|
||||
`e:/nxdk_pgraph_tests/pgraph_tests.cnf` and `d:\pgraph_tests.cnf`, taking
|
||||
whichever is found first. If neither is found, all tests will be executed.
|
||||
|
||||
The default release build will also write a template of this file called
|
||||
`config.cnf` (see the `DUMP_CONFIG_FILE` Makefile variable).
|
||||
|
||||
### Progress logging
|
||||
|
||||
If the `ENABLE_PROGRESS_LOG` Makefile variable is set to `y`, a progress log
|
||||
named `pgraph_progress_log.txt` will be saved in the output directory. This may
|
||||
be useful when trying to track down emulator crashes (e.g., due to unimplemented
|
||||
features).
|
||||
|
||||
### Controls
|
||||
|
||||
DPAD:
|
||||
|
25
src/main.cpp
25
src/main.cpp
@ -81,7 +81,7 @@ static constexpr int kFramebufferHeight = 480;
|
||||
static constexpr int kTextureWidth = 256;
|
||||
static constexpr int kTextureHeight = 256;
|
||||
|
||||
static constexpr const char* kLogFileName = "log.txt";
|
||||
static constexpr const char* kLogFileName = "pgraph_progress_log.txt";
|
||||
|
||||
static void register_suites(TestHost& host, std::vector<std::shared_ptr<TestSuite>>& test_suites,
|
||||
const std::string& output_directory);
|
||||
@ -89,7 +89,7 @@ static bool get_writable_output_directory(std::string& xbe_root_directory);
|
||||
static bool get_test_output_path(std::string& test_output_directory);
|
||||
static void dump_config_file(const std::string& config_file_path,
|
||||
const std::vector<std::shared_ptr<TestSuite>>& test_suites);
|
||||
static void process_config(const char* config_file_path, std::vector<std::shared_ptr<TestSuite>>& test_suites);
|
||||
static bool process_config(const char* config_file_path, std::vector<std::shared_ptr<TestSuite>>& test_suites);
|
||||
|
||||
/* Main program function */
|
||||
int main() {
|
||||
@ -148,9 +148,14 @@ int main() {
|
||||
dump_config_file(test_output_directory + "\\config.cnf", test_suites);
|
||||
#endif
|
||||
|
||||
bool config_parsed = false;
|
||||
#ifdef RUNTIME_CONFIG_PATH
|
||||
process_config(RUNTIME_CONFIG_PATH, test_suites);
|
||||
config_parsed = process_config(RUNTIME_CONFIG_PATH, test_suites);
|
||||
#endif
|
||||
if (!config_parsed) {
|
||||
// Optionally parse a bundled config.cnf
|
||||
process_config("d:\\pgraph_tests.cnf", test_suites);
|
||||
}
|
||||
|
||||
TestDriver driver(host, test_suites, kFramebufferWidth, kFramebufferHeight);
|
||||
driver.Run();
|
||||
@ -244,16 +249,20 @@ static void dump_config_file(const std::string& config_file_path,
|
||||
}
|
||||
}
|
||||
|
||||
static void process_config(const char* config_file_path, std::vector<std::shared_ptr<TestSuite>>& test_suites) {
|
||||
static bool process_config(const char* config_file_path, std::vector<std::shared_ptr<TestSuite>>& test_suites) {
|
||||
if (!ensure_drive_mounted(config_file_path[0])) {
|
||||
ASSERT(!"Failed to mount config path")
|
||||
PrintMsg("Ignoring missing config at %s\n", config_file_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string dos_style_path = config_file_path;
|
||||
std::replace(dos_style_path.begin(), dos_style_path.end(), '/', '\\');
|
||||
std::map<std::string, std::vector<std::string>> test_config;
|
||||
std::ifstream config_file(dos_style_path.c_str());
|
||||
ASSERT(config_file && "Failed to open config file");
|
||||
if (!config_file) {
|
||||
PrintMsg("Ignoring missing config at %s\n", config_file_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
// The config file is a list of test suite names (one per line), each optionally followed by lines containing a test
|
||||
// name prefixed with '-' (indicating that test should be disabled).
|
||||
@ -290,9 +299,11 @@ static void process_config(const char* config_file_path, std::vector<std::shared
|
||||
}
|
||||
|
||||
if (filtered_tests.empty()) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
test_suites = filtered_tests;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void register_suites(TestHost& host, std::vector<std::shared_ptr<TestSuite>>& test_suites,
|
||||
|
Loading…
Reference in New Issue
Block a user