mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
add '--debugger' argument to vctest
This commit is contained in:
parent
38da5c89f5
commit
7958e82a25
3 changed files with 19 additions and 8 deletions
2
.github/workflows/appimage.yml
vendored
2
.github/workflows/appimage.yml
vendored
|
|
@ -52,7 +52,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
chmod +x build/VoxelEngine
|
chmod +x build/VoxelEngine
|
||||||
chmod +x AppDir/usr/bin/vctest
|
chmod +x AppDir/usr/bin/vctest
|
||||||
AppDir/usr/bin/vctest -e build/VoxelEngine -d dev/tests -u build
|
AppDir/usr/bin/vctest -e build/VoxelEngine -d dev/tests -u build --memchecker valgrind
|
||||||
- name: Build AppImage
|
- name: Build AppImage
|
||||||
uses: AppImageCrafters/build-appimage-action@fe2205a4d6056be47051f7b1b3811106e9814910
|
uses: AppImageCrafters/build-appimage-action@fe2205a4d6056be47051f7b1b3811106e9814910
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
|
|
@ -49,7 +49,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
chmod +x build/VoxelEngine
|
chmod +x build/VoxelEngine
|
||||||
chmod +x AppDir/usr/bin/vctest
|
chmod +x AppDir/usr/bin/vctest
|
||||||
AppDir/usr/bin/vctest -e build/VoxelEngine -d dev/tests -u build --output-always --memchecker "lldb -batch -o 'run' -o 'thread backtrace all' -o 'quit' -- "
|
AppDir/usr/bin/vctest -e build/VoxelEngine -d dev/tests -u build --output-always --debugger "lldb -batch -o 'run' -o 'thread backtrace all' -o 'quit' -- "
|
||||||
- name: Create DMG
|
- name: Create DMG
|
||||||
run: |
|
run: |
|
||||||
mkdir VoxelEngineDmgContent
|
mkdir VoxelEngineDmgContent
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ struct Config {
|
||||||
fs::path directory;
|
fs::path directory;
|
||||||
fs::path resDir {"res"};
|
fs::path resDir {"res"};
|
||||||
fs::path workingDir {"."};
|
fs::path workingDir {"."};
|
||||||
std::string memchecker = "valgrind";
|
std::string memchecker = "";
|
||||||
|
std::string debugger = "";
|
||||||
bool outputAlways = false;
|
bool outputAlways = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -30,6 +31,7 @@ static bool perform_keyword(
|
||||||
std::cout << " --tests <path>, -d <path> = tests directory path\n";
|
std::cout << " --tests <path>, -d <path> = tests directory path\n";
|
||||||
std::cout << " --res <path>, -r <path> = 'res' directory path\n";
|
std::cout << " --res <path>, -r <path> = 'res' directory path\n";
|
||||||
std::cout << " --user <path>, -u <path> = user directory path\n";
|
std::cout << " --user <path>, -u <path> = user directory path\n";
|
||||||
|
std::cout << " --debugger <command> = debugger with run command\n";
|
||||||
std::cout << " --memchecker <path> = path to valgrind\n";
|
std::cout << " --memchecker <path> = path to valgrind\n";
|
||||||
std::cout << " --output-always = always show tests output\n";
|
std::cout << " --output-always = always show tests output\n";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
@ -44,6 +46,8 @@ static bool perform_keyword(
|
||||||
config.workingDir = fs::path(reader.next());
|
config.workingDir = fs::path(reader.next());
|
||||||
} else if (keyword == "--output-always") {
|
} else if (keyword == "--output-always") {
|
||||||
config.outputAlways = true;
|
config.outputAlways = true;
|
||||||
|
} else if (keyword == "--debugger") {
|
||||||
|
config.debugger = reader.next();
|
||||||
} else if (keyword == "--memchecker") {
|
} else if (keyword == "--memchecker") {
|
||||||
config.memchecker = reader.next();
|
config.memchecker = reader.next();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -172,7 +176,7 @@ static std::string fix_path(std::string s) {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool run_test(const Config& config, const fs::path& path, bool memcheck = false) {
|
static bool run_test(const Config& config, const fs::path& path, bool debugRun = false) {
|
||||||
using std::chrono::duration_cast;
|
using std::chrono::duration_cast;
|
||||||
using std::chrono::high_resolution_clock;
|
using std::chrono::high_resolution_clock;
|
||||||
using std::chrono::milliseconds;
|
using std::chrono::milliseconds;
|
||||||
|
|
@ -182,9 +186,16 @@ static bool run_test(const Config& config, const fs::path& path, bool memcheck =
|
||||||
|
|
||||||
auto name = path.stem();
|
auto name = path.stem();
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
if (memcheck) {
|
if (debugRun) {
|
||||||
ss << config.memchecker << /*" --log-file="
|
if (!config.memchecker.empty()) {
|
||||||
<< fix_path(memcheckLogFile.string()) <<*/ " ";
|
ss << config.memchecker;
|
||||||
|
ss << " --log-file=" << fix_path(memcheckLogFile.string());
|
||||||
|
ss << " ";
|
||||||
|
}
|
||||||
|
if (!config.debugger.empty()) {
|
||||||
|
ss << config.debugger;
|
||||||
|
ss << " ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ss << fs::canonical(config.executable) << " --headless";
|
ss << fs::canonical(config.executable) << " --headless";
|
||||||
ss << " --test " << fix_path(path.string());
|
ss << " --test " << fix_path(path.string());
|
||||||
|
|
@ -203,7 +214,7 @@ static bool run_test(const Config& config, const fs::path& path, bool memcheck =
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
if (code) {
|
if (code) {
|
||||||
if (memcheck) {
|
if (debugRun) {
|
||||||
// valgrind-specific output
|
// valgrind-specific output
|
||||||
display_segfault_valgrind(memcheckLogFile, name, std::cerr);
|
display_segfault_valgrind(memcheckLogFile, name, std::cerr);
|
||||||
fs::remove(memcheckLogFile);
|
fs::remove(memcheckLogFile);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue