tests: use a more robust path to self_hosted.zig

closes #184
This commit is contained in:
Andrew Kelley 2016-09-14 03:10:56 -04:00
parent c65fe384dd
commit 3f05fdc8e8
2 changed files with 9 additions and 1 deletions

View File

@ -18,4 +18,7 @@
#cmakedefine ZIG_LLVM_OLD_CXX_ABI
// Only used for running tests before installing.
#define ZIG_TEST_DIR "@CMAKE_SOURCE_DIR@/test"
#endif

View File

@ -9,6 +9,7 @@
#include "buffer.hpp"
#include "os.hpp"
#include "error.hpp"
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
@ -1831,11 +1832,15 @@ struct type {
}
static void run_self_hosted_test(bool is_release_mode) {
Buf self_hosted_tests_file = BUF_INIT;
os_path_join(buf_create_from_str(ZIG_TEST_DIR),
buf_create_from_str("self_hosted.zig"), &self_hosted_tests_file);
Buf zig_stderr = BUF_INIT;
Buf zig_stdout = BUF_INIT;
ZigList<const char *> args = {0};
args.append("test");
args.append("../test/self_hosted.zig");
args.append(buf_ptr(&self_hosted_tests_file));
if (is_release_mode) {
args.append("--release");
}