-
-
Notifications
You must be signed in to change notification settings - Fork 699
Move common BASH test logic to wrapper #7928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,8 @@ | |
|
|
||
| # Test CRLF and mixed line ending handling in D lexer. | ||
|
|
||
| name=`basename $0 .sh` | ||
| dir=${RESULTS_DIR}/compilable | ||
| fn=${dir}/${name}.d | ||
| fn=${TEST_DIR}/${TEST_NAME}.d | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a next step |
||
|
|
||
| printf '%s\r\n' \ | ||
| '#!/usr/bin/env dmd -run' \ | ||
|
|
@@ -46,8 +45,8 @@ printf 'static assert(wstr == "%s");\n' 'foo\nbar\nbaz\n' >> ${fn} | |
| printf 'enum dstr = q"(\r\nfoo\r\nbar\nbaz\r\n)";\n' >> ${fn} | ||
| printf 'static assert(dstr == "%s");\n' '\nfoo\nbar\nbaz\n' >> ${fn} | ||
|
|
||
| $DMD -c -D -Dd${dir} -m${MODEL} -of${dir}/${name}a${OBJ} ${fn} || exit 1 | ||
| $DMD -c -D -Dd${TEST_DIR} -m${MODEL} -of${TEST_DIR}/${TEST_NAME}a${OBJ} ${fn} || exit 1 | ||
|
|
||
| rm -f ${dir}/${name}a${OBJ} ${dir}/${name}.html ${fn} | ||
| rm -f ${TEST_DIR}/${TEST_NAME}a${OBJ} ${TEST_DIR}/${TEST_NAME}.html ${fn} | ||
|
|
||
| echo Success >${dir}/`basename $0`.out | ||
| echo Success | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,9 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| name=`basename $0 .sh` | ||
| dir=${RESULTS_DIR}/compilable | ||
| output_file=${dir}/${name}.html | ||
| output_file=${RESULTS_DIR}/${TEST_DIR}/${TEST_NAME}.html | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be quite frequent enough. could be part of a next step.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one is common enough, I'll add it to this PR
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, wait, this is specific to this test only...it has the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's why
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I wasn't sure the best variables to expose...there's combinations of the source dir vs results dir and different extensions...we can figure it out in the next step like you said |
||
|
|
||
| rm -f ${output_file} | ||
|
|
||
| $DMD -m${MODEL} -D -o- compilable/extra-files/ddoc9764.dd -Df${output_file} | ||
|
|
||
| compilable/extra-files/ddocAny-postscript.sh 9764 && touch ${dir}/`basename $0`.out | ||
| compilable/extra-files/ddocAny-postscript.sh 9764 && touch ${TEST_DIR}/${TEST_NAME}.out | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,12 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| name=`basename $0 .sh` | ||
| dir=${RESULTS_DIR}/compilable | ||
| src=compilable/extra-files | ||
|
|
||
| $DMD -c -m${MODEL} -of${dir}/${name}a${OBJ} -I${src} ${src}/${name}a.d || exit 1 | ||
| $DMD -c -m${MODEL} -of${dir}/${TEST_NAME}a${OBJ} -I${src} ${src}/${TEST_NAME}a.d || exit 1 | ||
|
|
||
| $DMD -unittest -m${MODEL} -od${dir} -I${src} ${src}/${name}main.d ${dir}/${name}a${OBJ} || exit 1 | ||
| $DMD -unittest -m${MODEL} -od${dir} -I${src} ${src}/${TEST_NAME}main.d ${dir}/${TEST_NAME}a${OBJ} || exit 1 | ||
|
|
||
| rm -f ${dir}/{${name}a${OBJ} ${name}main${EXE} ${name}main${OBJ}} | ||
| rm -f ${dir}/{${TEST_NAME}a${OBJ} ${TEST_NAME}main${EXE} ${TEST_NAME}main${OBJ}} | ||
|
|
||
| echo Success >${dir}/`basename $0`.out | ||
| echo Success |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if [ "${RESULTS_DIR}" == "" ]; then | ||
| echo Note: this program is normally called through the Makefile, it | ||
| echo is not meant to be called directly by the user. | ||
| exit 1 | ||
| fi | ||
|
|
||
| # TEST_DIR should be one of compilable, fail_compilation or runnable | ||
| export TEST_DIR=$1 | ||
| export TEST_NAME=$2 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a few more variables which I frequently need, but I think we can easily go step by step here. |
||
| script_name=${TEST_DIR}/${TEST_NAME}.sh | ||
|
|
||
| echo " ... ${script_name}" | ||
|
|
||
| output_file=${RESULTS_DIR}/${script_name}.out | ||
| rm -f ${output_file} | ||
|
|
||
| ./${script_name} > ${output_file} 2>&1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A future extension could use
|
||
| if [ $? -ne 0 ]; then | ||
| # duplicate d_do_test output | ||
| echo >> ${output_file} | ||
| echo ============================== >> ${output_file} | ||
| echo Test ${script_name} failed >> ${output_file} | ||
|
|
||
| echo Test ${script_name} failed. The logged output: | ||
| cat ${output_file} | ||
| exit 1 | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is no longer used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, replaced with
${TEST_NAME}