Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions compiler/test/compilable/extra-files/minimal/verify_symbols.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
#!/usr/bin/env bash

if [[ $OS = "win"* ]]; then
for tool in nm objdump; do
if ! which -s $tool; then
echo "No '$tool' tool found in PATH, skipping symbols verification on Windows."
exit 0
fi
done
fi

obj_file="${RESULTS_TEST_DIR}/d/${TEST_NAME}_0${OBJ}"

# ensure no ModuleInfo or TypeInfo related code was generated
if ! nm "$1" | grep -q 'ModuleInfo\|_d_dso_registry\__start_minfo\|__stop_minfo\|TypeInfo' ; then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$1 is a path to a *.d.out file, apparently a text file containing the command-line for the earlier compiler run. So this verify_symbols.sh step was totally broken, just not failing because any nm error (incl. not in PATH) was ignored and treated as 'hey, the symbol is not there!'.

if nm "${obj_file}" | { ! grep -q 'ModuleInfo\|_d_dso_registry\__start_minfo\|__stop_minfo\|TypeInfo'; } ; then
# ensure no exception handling code was generated
if ! objdump -h "$1" | grep -q ".eh_frame" ; then
if objdump -h "${obj_file}" | { ! grep -q ".eh_frame"; } ; then
exit 0
fi
fi
Expand Down
6 changes: 5 additions & 1 deletion compiler/test/compilable/test19463.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env bash

if [[ $OS = "win"* ]] && ! which -s nm; then
echo 'No `nm` tool found in PATH, skipping test on Windows.'
exit 0
fi

$DMD -c -preview=dip1008 -m${MODEL} -of${OUTPUT_BASE}${OBJ} -I${EXTRA_FILES} ${EXTRA_FILES}/${TEST_NAME}.d
!(nm ${OUTPUT_BASE}${OBJ} | grep _d_newclass)
Comment thread
kinke marked this conversation as resolved.
Resolved
nm ${OUTPUT_BASE}${OBJ} | { ! grep _d_newclass; }

rm_retry ${OUTPUT_BASE}${OBJ}
5 changes: 5 additions & 0 deletions compiler/test/compilable/test21331.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

if [[ $OS = "win"* ]] && ! which -s nm; then
echo 'No `nm` tool found in PATH, skipping test on Windows.'
exit 0
fi

objfile="${OUTPUT_BASE}${OBJ}"
$DMD -c -m${MODEL} -of${objfile} ${EXTRA_FILES}/${TEST_NAME}.d

Expand Down
5 changes: 5 additions & 0 deletions compiler/test/compilable/test21359.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

if [[ $OS = "win"* ]] && ! which -s nm; then
echo 'No `nm` tool found in PATH, skipping test on Windows.'
exit 0
fi

objfile="${OUTPUT_BASE}${OBJ}"
$DMD -c -m${MODEL} -allinst -of${objfile} ${EXTRA_FILES}/${TEST_NAME}a.d -I${EXTRA_FILES}

Expand Down
2 changes: 1 addition & 1 deletion compiler/test/runnable/test17619.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ fi

$DMD -m${MODEL} -I${EXTRA_FILES} -of${OUTPUT_BASE}${OBJ} -c ${EXTRA_FILES}${SEP}test17619.d
# error out if there is an advance by 0 for a non.zero address
! objdump -Wl ${OUTPUT_BASE}${OBJ} | grep "advance Address by 0 to 0x[1-9]"
objdump -Wl ${OUTPUT_BASE}${OBJ} | { ! grep "advance Address by 0 to 0x[1-9]"; }

rm_retry ${OUTPUT_BASE}${OBJ}
Loading