From 3f05fdc8e8fdc25faec2ca51547404411b314ce1 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 14 Sep 2016 03:10:56 -0400 Subject: [PATCH] tests: use a more robust path to self_hosted.zig closes #184 --- src/config.h.in | 3 +++ test/run_tests.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/config.h.in b/src/config.h.in index 3ad0dadf1b7e3616d1f33132a69e10929b7f68a6..24110e2a43c4ce6585a5fa4fb106af5b5016e76c 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -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 diff --git a/test/run_tests.cpp b/test/run_tests.cpp index a0fa1c7ad41b0f5647c41836ed00ff91fa99024f..95fc6fc3d4a0851134db225bbe9328666bd1f38b 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -9,6 +9,7 @@ #include "buffer.hpp" #include "os.hpp" #include "error.hpp" +#include "config.h" #include #include @@ -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 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"); } -- 2.54.0