Commit 5f0ea43
committed
test: run tests in build dir, pass source dir in env
This works around an annoyance with gtest_discover_tests.
The test discovery system works by running the test binary with flags
to make it produce a JSON file that gives details of all the tests.
However, that file is written to the working directory. If we set the
working directory for the tests to be the source directory, then
the tests can access their test data by relative paths, but the
JSON test details files for test discovery get written to the
source directory, which is ugly.
So, we instead provide the location of the source tree through an
environment variable, and then in the tests themselves we change
the current working directory to the source tree directory.
Why change CWD instead of just using absolute paths for input files?
Because error messages produced by jsonnet include the file paths,
and we need (or at least want) those to still be relative paths so
that we can compare against stable golden outputs.1 parent 733b9b5 commit 5f0ea43
File tree
3 files changed
+63
-15
lines changed- core
- cpp
3 files changed
+63
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
312 | | - | |
313 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
314 | 315 | | |
315 | 316 | | |
316 | 317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
27 | 51 | | |
28 | 52 | | |
29 | 53 | | |
| |||
35 | 59 | | |
36 | 60 | | |
37 | 61 | | |
38 | | - | |
| 62 | + | |
39 | 63 | | |
40 | | - | |
41 | 64 | | |
42 | 65 | | |
43 | 66 | | |
44 | | - | |
| 67 | + | |
45 | 68 | | |
46 | 69 | | |
47 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
27 | 51 | | |
28 | | - | |
| 52 | + | |
29 | 53 | | |
30 | | - | |
| 54 | + | |
31 | 55 | | |
32 | 56 | | |
33 | 57 | | |
34 | 58 | | |
35 | 59 | | |
36 | | - | |
| 60 | + | |
37 | 61 | | |
38 | 62 | | |
39 | 63 | | |
| |||
46 | 70 | | |
47 | 71 | | |
48 | 72 | | |
49 | | - | |
| 73 | + | |
50 | 74 | | |
51 | 75 | | |
52 | 76 | | |
| |||
59 | 83 | | |
60 | 84 | | |
61 | 85 | | |
62 | | - | |
| 86 | + | |
63 | 87 | | |
64 | 88 | | |
65 | 89 | | |
| |||
71 | 95 | | |
72 | 96 | | |
73 | 97 | | |
74 | | - | |
| 98 | + | |
75 | 99 | | |
76 | 100 | | |
77 | 101 | | |
| |||
83 | 107 | | |
84 | 108 | | |
85 | 109 | | |
86 | | - | |
| 110 | + | |
87 | 111 | | |
88 | 112 | | |
89 | 113 | | |
| |||
0 commit comments