Add and use RESULTS_TEST_DIR + OUTPUT_BASE + EXTRA_FILES in the bash scripts of DMD's testsuite#8038
Conversation
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#8038" |
| $DMD -c -od=${dir} -Xi=compilerInfo compilable/extra-files/emptymain.d > ${output_file} | ||
| rm -f emptymain.json || true | ||
| $DMD -c -od=${RESULTS_TEST_DIR} -Xi=compilerInfo ${EXTRA_FILES}/emptymain.d | ||
| rm -f emptymain.json |
test/compilable/test6461.sh
Outdated
| $DMD -m${MODEL} -od${RESULTS_OUTPUT} -I${src} ${src}/main.d ${RESULTS_OUTPUT}/a${LIBEXT} ${RESULTS_OUTPUT}/b${LIBEXT} || exit 1 | ||
|
|
||
| rm -f ${dir}/{a${LIBEXT} b${LIBEXT} main${EXE} main${OBJ}} | ||
| rm -f ${RESULTS_OUTPUT}/{a${LIBEXT} b${LIBEXT} main${EXE} main${OBJ}} |
There was a problem hiding this comment.
That's one of the cases where just nuking the RESULTS_OUTPUT folder would make sense (and is probably a good default (if no error happened), but I went with keeping the existing behavior to make reviewing easy.
| echo >> ${output_file} | ||
| echo "Dependencies file:" | ||
| cat ${deps_file} | ||
| echo |
There was a problem hiding this comment.
stdout is redirected to the output by default. See #8025 which makes this even more interesting with a verbose stack trace.
test/compilable/issue17167.sh
Outdated
| rm -rf "${dir:?}"/"$TEST_NAME" | ||
| rm -rf "${RESULTS_OUTPUT}" | ||
|
|
||
| echo Success |
There was a problem hiding this comment.
This is superfluous too, but already removed in #8025
test/runnable/gdb15729.sh
Outdated
| $DMD -g -m${MODEL} -I${src} -of${libname} -lib ${src}${SEP}lib15729.d || exit 1 | ||
| $DMD -g -m${MODEL} -I${src} -of${dir}${SEP}gdb15729${EXE} ${src}${SEP}gdb15729.d ${libname} || exit 1 | ||
| $DMD -g -m${MODEL} -I${EXTRA_FILES} -of${RESULTS_OUTPUT}${LIBEXT} -lib ${EXTRA_FILES}${SEP}lib15729.d || exit 1 | ||
| $DMD -g -m${MODEL} -I${EXTRA_FILES} -of${RESULTS_OUTPUT}${EXE} ${EXTRA_FILES}${SEP}gdb15729.d ${RESULTS_OUTPUT}${LIBEXT} || exit 1 |
There was a problem hiding this comment.
All these || exit 1 should be removed to and be replaced with set -e, but that's a task for another PR.
6a476f4 to
e3bc75a
Compare
test/sh_do_test.sh
Outdated
| export TEST_DIR=$1 # TEST_DIR should be one of compilable, fail_compilation or runnable | ||
| export TEST_NAME=$2 # name of the test, e.g. test12345 | ||
| export RESULTS_TEST_DIR=${RESULTS_DIR}/${TEST_DIR} # reference to the resulting test_dir folder, e.g .test_results/runnable | ||
| export RESULTS_OUTPUT=${RESULTS_TEST_DIR}/${TEST_NAME} # reference to the resulting files without a suffix, e.g. test_results/runnabel/test123 |
There was a problem hiding this comment.
Maybe ${RESULTS_OUTPUT_BASE} ? But it is used quite a bit...maybe it's OK as it is... Or maybe we don't need RESULTS, maybe OUTPUT_PREFIX? or OUTPUT_BASE?
There was a problem hiding this comment.
Good idea - I went with OUTPUT_BASE, but I don't have any strong preference.
2765d3e to
2631c41
Compare
9800c01 to
5bd858e
Compare
|
(For another PR) |
07a3eff to
76734bd
Compare
|
(rebased as #8025 with the verbose xtracing is now in) |
N.B. Many D tests are missing EXTRA_FILES (or maybe EXTRA_SOURCES) also if you are interested in running tests in an isolated temporary directory. |
|
Yes, I'm aware and I don't have plan working on this in the near future though I might look into replacing the bash scripts with D scripts to please the people on Windows, but I don't use/have Windows, so that's not super-high on my priority list. (anyhow merge conflicts resolved) |
|
The big disadvantage I see with "D" is it could make the tests suite take a bit longer since D takes a while to compile when compared to the time it takes to interpret a BASH script. But having to run BASH in Windows is something I haven't been able to get working. |
Turns out we can save quite a lot when we move the redundant definitions in the bash files to the new wrapper.
This also opens the opportunity to run the shell script in a temporary directory [1] or do other things as now most scripts don't have any hard-coded information anymore.
I'm not fixed about the names
EXTRA_FILEScould also be namedSRCfor example.[1] this would mean e.g. that no manual cleaning of the generated files is necessary anymore, but it's just one potential opportunity. The big motivation of this PR is to remove the redundant declarations and thus let the test scripts focus on what's important: testing and not startup/cleanup code.
CC @marler8997 @timotheecour @CyberShadow