tests/jak2: Better prepare offline tests for multiple games (#1591)

* git: ignore vs build dir

* cmake: ditch `clang-cl` on windows in favor of actual `clang`

* build: suppress a significant number of warnings

* build: adjust workflows and vendor nasm

* docs: update docs to remove `clang-cl` mentions

* tests: move jak1 reference tests into their own folder

* tests: update offline tests to support multiple games

* tests: some additional fixes and multi-game handling

* tests: update reference tests
This commit is contained in:
Tyler Wilding 2022-07-06 18:10:38 -04:00 committed by GitHub
parent 9ede08977f
commit 8a18072d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
491 changed files with 289 additions and 281 deletions

3
.gitattributes vendored
View File

@ -1,3 +1,6 @@
# Ensure line endings are consistently 'LF'
* text=auto
third-party/**/* linguist-vendored third-party/**/* linguist-vendored
third-party/**/* linguist-generated third-party/**/* linguist-generated
test/decompiler/reference/** linguist-vendored test/decompiler/reference/** linguist-vendored

View File

@ -54,7 +54,6 @@ jobs:
CC: clang CC: clang
CXX: clang++ CXX: clang++
run: | run: |
ls -l ${{ github.workspace }}/buildcache/bin/buildcache
cmake -B build \ cmake -B build \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DASAN_BUILD=ON \ -DASAN_BUILD=ON \

View File

@ -41,56 +41,61 @@
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "offline-test.exe (bin\\offline-test.exe)", "projectTarget": "offline-test.exe (bin\\offline-test.exe)",
"name": "Tests - Offline Tests", "name": "Tests - Offline Tests - Jak 1",
"args": ["${workspaceRoot}/iso_data/jak1"] "args": [
"--iso_data_path",
"${workspaceRoot}/iso_data/jak1",
"--game",
"jak1"
]
}, },
{ {
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "gk.exe (bin\\gk.exe)", "projectTarget": "gk.exe (bin\\gk.exe)",
"name": "Run - Runtime (no kernel)", "name": "Game - Runtime (no kernel)",
"args": ["-fakeiso", "-debug", "-nokernel", "-v", "-nodisplay"] "args": ["-fakeiso", "-debug", "-nokernel", "-v", "-nodisplay"]
}, },
{ {
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "gk.exe (bin\\gk.exe)", "projectTarget": "gk.exe (bin\\gk.exe)",
"name": "Run - Runtime (with kernel)", "name": "Game - Runtime (with kernel)",
"args": ["-fakeiso", "-debug", "-v"] "args": ["-fakeiso", "-debug", "-v"]
}, },
{ {
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "gk.exe (bin\\gk.exe)", "projectTarget": "gk.exe (bin\\gk.exe)",
"name": "Run - Runtime (boot)", "name": "Game - Runtime (boot)",
"args": ["-boot", "-fakeiso", "-debug", "-v"] "args": ["-boot", "-fakeiso", "-debug", "-v"]
}, },
{ {
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "gk.exe (bin\\gk.exe)", "projectTarget": "gk.exe (bin\\gk.exe)",
"name": "Run - Runtime (boot no debug)", "name": "Game - Runtime (boot no debug)",
"args": ["-boot", "-fakeiso", "-v"] "args": ["-boot", "-fakeiso", "-v"]
}, },
{ {
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "goalc.exe (bin\\goalc.exe)", "projectTarget": "goalc.exe (bin\\goalc.exe)",
"name": "Run - REPL", "name": "REPL",
"args": ["--user-auto"] "args": ["--user-auto"]
}, },
{ {
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "goalc.exe (bin\\goalc.exe)", "projectTarget": "goalc.exe (bin\\goalc.exe)",
"name": "Run - REPL - Auto Listen", "name": "REPL - Auto Listen",
"args": ["--user-auto", "--auto-lt"] "args": ["--user-auto", "--auto-lt"]
}, },
{ {
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "decompiler.exe (bin\\decompiler.exe)", "projectTarget": "decompiler.exe (bin\\decompiler.exe)",
"name": "Run - Decompiler - Jak 1", "name": "Decompiler - Jak 1",
"args": [ "args": [
"${workspaceRoot}/decompiler/config/jak1_ntsc_black_label.jsonc", "${workspaceRoot}/decompiler/config/jak1_ntsc_black_label.jsonc",
"${workspaceRoot}/iso_data", "${workspaceRoot}/iso_data",
@ -101,7 +106,7 @@
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "decompiler.exe (bin\\decompiler.exe)", "projectTarget": "decompiler.exe (bin\\decompiler.exe)",
"name": "Run - Decompiler - Jak 1 - Data Only", "name": "Decompiler - Jak 1 - Data Only",
"args": [ "args": [
"${workspaceRoot}/decompiler/config/jak1_ntsc_black_label.jsonc", "${workspaceRoot}/decompiler/config/jak1_ntsc_black_label.jsonc",
"${workspaceRoot}/iso_data", "${workspaceRoot}/iso_data",
@ -113,7 +118,7 @@
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "decompiler.exe (bin\\decompiler.exe)", "projectTarget": "decompiler.exe (bin\\decompiler.exe)",
"name": "Run - Decompiler - Jak 1 PAL", "name": "Decompiler - Jak 1 PAL",
"args": [ "args": [
"${workspaceRoot}/decompiler/config/jak1_pal.jsonc", "${workspaceRoot}/decompiler/config/jak1_pal.jsonc",
"${workspaceRoot}/iso_data", "${workspaceRoot}/iso_data",
@ -124,7 +129,7 @@
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "decompiler.exe (bin\\decompiler.exe)", "projectTarget": "decompiler.exe (bin\\decompiler.exe)",
"name": "Run - Disassembler - Jak 1", "name": "Disassembler - Jak 1",
"args": [ "args": [
"${workspaceRoot}/decompiler/config/jak1_ntsc_black_label.jsonc", "${workspaceRoot}/decompiler/config/jak1_ntsc_black_label.jsonc",
"${workspaceRoot}/iso_data", "${workspaceRoot}/iso_data",
@ -135,7 +140,7 @@
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "decompiler.exe (bin\\decompiler.exe)", "projectTarget": "decompiler.exe (bin\\decompiler.exe)",
"name": "Run - Decompiler - Jak 2", "name": "Decompiler - Jak 2",
"args": [ "args": [
"${workspaceRoot}/decompiler/config/jak2_ntsc_v1.jsonc", "${workspaceRoot}/decompiler/config/jak2_ntsc_v1.jsonc",
"${workspaceRoot}/iso_data", "${workspaceRoot}/iso_data",
@ -146,24 +151,14 @@
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "memory_dump_tool.exe (bin\\memory_dump_tool.exe)", "projectTarget": "memory_dump_tool.exe (bin\\memory_dump_tool.exe)",
"name": "Run - EE Memory Analyze", "name": "Tools - EE Memory Analyze",
"args": ["${workspaceRoot}/eeMemory.bin", "${workspaceRoot}"] "args": ["${workspaceRoot}/eeMemory.bin", "${workspaceRoot}"]
}, },
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "memory_dump_tool.exe (bin\\memory_dump_tool.exe)",
"name": "Run - EE Memory Analyze - Test",
"args": [
"\"C:\\Users\\xtvas\\Repositories\\pcsx2\\128mb\\sstates\\SCUS-97124 (1B3976AB).00.p2s\"",
"${workspaceRoot}"
]
},
{ {
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "dgo_unpacker.exe (bin\\dgo_unpacker.exe)", "projectTarget": "dgo_unpacker.exe (bin\\dgo_unpacker.exe)",
"name": "Run - DGO Unpacker (test)", "name": "Tools - DGO Unpacker (test)",
"args": [ "args": [
"C:\\GameData\\Jak1\\Backup\\DGO-PAL\\GAME", "C:\\GameData\\Jak1\\Backup\\DGO-PAL\\GAME",
"C:\\GameData\\Jak1\\Backup\\DISC-PAL\\CGO\\GAME.CGO" "C:\\GameData\\Jak1\\Backup\\DISC-PAL\\CGO\\GAME.CGO"
@ -173,8 +168,8 @@
"type": "default", "type": "default",
"project": "CMakeLists.txt", "project": "CMakeLists.txt",
"projectTarget": "extractor.exe (bin\\extractor.exe)", "projectTarget": "extractor.exe (bin\\extractor.exe)",
"name": "Run - Extractor - Extract", "name": "Tools - Extractor - Extract",
"args": ["\"E:\\ISOs\\Jak\\дWTF平仮名WTF\\Jak 1.iso\""] "args": ["E:\\ISOs\\Jak\\Jak 1.iso"]
} }
] ]
} }

View File

@ -111,7 +111,7 @@ tasks:
# TESTS # TESTS
offline-tests: offline-tests:
cmds: cmds:
- '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test "./iso_data/{{.GAME}}"' - '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test --iso_data_path "./iso_data/{{.GAME}}" --game {{.GAME}}'
# TODO - update or replace # TODO - update or replace
# add-reference-test: # add-reference-test:
# cmds: # cmds:
@ -122,13 +122,13 @@ tasks:
# cmds: # cmds:
# - python ./scripts/add-reference-test.py --file "{{.FILES}}" # - python ./scripts/add-reference-test.py --file "{{.FILES}}"
# - task: offline-tests # - task: offline-tests
# update-reference-tests: update-reference-tests:
# cmds: cmds:
# - cmd: python ./scripts/default-file-or-folder.py --path failures - cmd: python ./scripts/default-file-or-folder.py --path failures
# - cmd: '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test "./iso_data/{{.GAME}}" --dump-mode' - cmd: '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test --iso_data_path "./iso_data/{{.GAME}}" --game {{.GAME}} --dump_current_output'
# ignore_error: true ignore_error: true
# - python ./scripts/update_decomp_reference.py ./failures ./test/decompiler/reference/ - python ./scripts/update_decomp_reference.py ./failures ./test/decompiler/reference/
# - task: offline-tests - task: offline-tests
# find-label-types: # find-label-types:
# cmds: # cmds:
# - python ./scripts/next-decomp-file.py --files "{{.FILES}}" # - python ./scripts/next-decomp-file.py --files "{{.FILES}}"

View File

@ -518,4 +518,16 @@ FILE* open_file(const fs::path& path, std::string mode) {
#endif #endif
} }
std::vector<fs::path> find_files_recursively(const fs::path base_dir, const std::regex& pattern) {
std::vector<fs::path> files = {};
for (auto& p : fs::recursive_directory_iterator(base_dir)) {
if (p.is_regular_file()) {
if (std::regex_match(fs::path(p.path()).filename().string(), pattern)) {
files.push_back(p.path());
}
}
}
return files;
}
} // namespace file_util } // namespace file_util

View File

@ -17,6 +17,7 @@
#endif #endif
#include <optional> #include <optional>
#include <regex>
#include <string> #include <string>
#include <vector> #include <vector>
@ -54,6 +55,6 @@ void ISONameFromAnimationName(char* dst, const char* src);
void assert_file_exists(const char* path, const char* error_message); void assert_file_exists(const char* path, const char* error_message);
bool dgo_header_is_compressed(const std::vector<u8>& data); bool dgo_header_is_compressed(const std::vector<u8>& data);
std::vector<u8> decompress_dgo(const std::vector<u8>& data_in); std::vector<u8> decompress_dgo(const std::vector<u8>& data_in);
FILE* open_file(const fs::path& path, std::string mode); FILE* open_file(const fs::path& path, std::string mode);
std::vector<fs::path> find_files_recursively(const fs::path base_dir, const std::regex& pattern);
} // namespace file_util } // namespace file_util

Some files were not shown because too many files have changed in this diff Show More