Skip to content
Closed
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
25 changes: 21 additions & 4 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ endif

include ../src/osmodel.mak

# default to PIC on x86_64, use PIC=1/0 to en-/disable PIC.
# Note that shared libraries and C files are always compiled with PIC.
ifeq ($(PIC),)
ifeq ($(MODEL),64) # x86_64
PIC:=1
else
PIC:=0
endif
endif
ifeq ($(PIC),1)
export PIC_FLAG:=-fPIC
else
export PIC_FLAG:=
endif

export OS

ifeq (freebsd,$(OS))
Expand All @@ -96,7 +111,7 @@ endif
QUIET=@
export RESULTS_DIR=test_results
export MODEL
export REQUIRED_ARGS=
export REQUIRED_ARGS+= $(PIC_FLAG)

ifeq ($(findstring win,$(OS)),win)
export ARGS=-inline -release -g -O
Expand Down Expand Up @@ -205,7 +220,9 @@ start_fail_compilation_tests: $(RESULTS_DIR)/.created $(RESULTS_DIR)/d_do_test$(

$(RESULTS_DIR)/d_do_test$(EXE): d_do_test.d $(RESULTS_DIR)/.created
@echo "Building d_do_test tool"
@echo "OS: $(OS)"
$(QUIET)$(DMD) -conf= $(MODEL_FLAG) -unittest -run d_do_test.d -unittest
$(QUIET)$(DMD) -conf= $(MODEL_FLAG) -od$(RESULTS_DIR) -of$(RESULTS_DIR)$(DSEP)d_do_test$(EXE) d_do_test.d
@echo "OS: '$(OS)'"
@echo "MODEL: '$(MODEL)'"
@echo "PIC: '$(PIC_FLAG)'"
$(DMD) -conf= $(MODEL_FLAG) $(PIC_FLAG) -unittest -run d_do_test.d -unittest
$(DMD) -conf= $(MODEL_FLAG) $(PIC_FLAG) -od$(RESULTS_DIR) -of$(RESULTS_DIR)$(DSEP)d_do_test$(EXE) d_do_test.d

4 changes: 2 additions & 2 deletions test/compilable/test14894.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ 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} ${PIC_FLAG} -of${dir}/${name}a${OBJ} -I${src} ${src}/${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} ${PIC_FLAG} -od${dir} -I${src} ${src}/${name}main.d ${dir}/${name}a${OBJ} || exit 1

rm -f ${dir}/{${name}a${OBJ} ${name}main${EXE} ${name}main${OBJ}}

Expand Down
6 changes: 3 additions & 3 deletions test/compilable/test6461.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ else
LIBEXT=.a
fi

$DMD -lib -m${MODEL} -of${dir}/a${LIBEXT} -I${src} ${src}/a.d || exit 1
$DMD -lib -m${MODEL} -of${dir}/b${LIBEXT} -I${src} ${src}/b.d || exit 1
$DMD -lib -m${MODEL} ${PIC_FLAG} -of${dir}/a${LIBEXT} -I${src} ${src}/a.d || exit 1
$DMD -lib -m${MODEL} ${PIC_FLAG} -of${dir}/b${LIBEXT} -I${src} ${src}/b.d || exit 1

$DMD -m${MODEL} -od${dir} -I${src} ${src}/main.d ${dir}/a${LIBEXT} ${dir}/b${LIBEXT} || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -od${dir} -I${src} ${src}/main.d ${dir}/a${LIBEXT} ${dir}/b${LIBEXT} || exit 1

rm -f ${dir}/{a${LIBEXT} b${LIBEXT} main${EXE} main${OBJ}}

Expand Down
4 changes: 2 additions & 2 deletions test/runnable/gdb15729.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ else
fi
libname=${dir}${SEP}lib15729${LIBEXT}

$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} ${PIC_FLAG} -I${src} -of${libname} -lib ${src}${SEP}lib15729.d || exit 1
$DMD -g -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}gdb15729${EXE} ${src}${SEP}gdb15729.d ${libname} || exit 1

if [ $OS == "linux" ]; then
cat > ${dir}${SEP}gdb15729.gdb <<-EOF
Expand Down
6 changes: 3 additions & 3 deletions test/runnable/link14198a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ fi
libname=${dir}${SEP}lib14198a${LIBEXT}

# build library
$DMD -m${MODEL} -I${src} -of${libname} -lib ${src}${SEP}std14198${SEP}array.d ${src}${SEP}std14198${SEP}conv.d ${src}${SEP}std14198${SEP}format.d ${src}${SEP}std14198${SEP}uni.d || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${libname} -lib ${src}${SEP}std14198${SEP}array.d ${src}${SEP}std14198${SEP}conv.d ${src}${SEP}std14198${SEP}format.d ${src}${SEP}std14198${SEP}uni.d || exit 1

# Do not link failure with library file, regardless the semantic order.
$DMD -m${MODEL} -I${src} -of${dir}${SEP}test14198a${EXE} ${src}${SEP}test14198.d ${libname} || exit 1
$DMD -m${MODEL} -I${src} -of${dir}${SEP}test14198a${EXE} -version=bug14198 ${src}${SEP}test14198.d ${libname} || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}test14198a${EXE} ${src}${SEP}test14198.d ${libname} || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}test14198a${EXE} -version=bug14198 ${src}${SEP}test14198.d ${libname} || exit 1

rm ${libname}
rm ${dir}/{test14198a${OBJ},test14198a${EXE}}
Expand Down
4 changes: 2 additions & 2 deletions test/runnable/link14198b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ libname=${dir}${SEP}lib14198b${LIBEXT}

# Do not link failure even without library file.

$DMD -m${MODEL} -I${src} -of${dir}${SEP}test14198b${EXE} ${src}${SEP}test14198.d > ${output_file} 2>&1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}test14198b${EXE} ${src}${SEP}test14198.d > ${output_file} 2>&1
grep -q "_D8std141984conv11__T2toTAyaZ9__T2toTbZ2toFNaNbNiNfbZAya" ${output_file} && exit 1

$DMD -m${MODEL} -I${src} -of${dir}${SEP}test14198b${EXE} -version=bug14198 ${src}${SEP}test14198.d > ${output_file} 2>&1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}test14198b${EXE} -version=bug14198 ${src}${SEP}test14198.d > ${output_file} 2>&1
grep -q "_D8std141984conv11__T2toTAyaZ9__T2toTbZ2toFNaNbNiNfbZAya" ${output_file} && exit 1

rm ${dir}/{test14198b${OBJ},test14198b${EXE}}
Expand Down
4 changes: 2 additions & 2 deletions test/runnable/link14834.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ fi
libname=${dir}${SEP}link14834${LIBEXT}
exename=${dir}${SEP}link14834${EXE}

$DMD -m${MODEL} -I${src} -lib -of${libname} ${src}${SEP}link14834a.d > ${output_file} || exit 1
$DMD -m${MODEL} -I${src} -inline -debug -of${exename} ${src}${SEP}link14834b.d ${libname} > ${output_file} || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -lib -of${libname} ${src}${SEP}link14834a.d > ${output_file} || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -inline -debug -of${exename} ${src}${SEP}link14834b.d ${libname} > ${output_file} || exit 1

${dir}/link14834 || exit 1

Expand Down
4 changes: 2 additions & 2 deletions test/runnable/link846.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ fi
libname=${dir}${SEP}link846${LIBEXT}

# build library with -release
$DMD -m${MODEL} -I${src} -of${libname} -release -boundscheck=off -lib ${src}${SEP}lib846.d
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${libname} -release -boundscheck=off -lib ${src}${SEP}lib846.d

# use lib with -debug
$DMD -m${MODEL} -I${src} -of${dir}${SEP}link846${EXE} -debug ${src}${SEP}main846.d ${libname}
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}link846${EXE} -debug ${src}${SEP}main846.d ${libname}

rm ${libname}
rm ${dir}/{link846${OBJ},link846${EXE}}
Expand Down
4 changes: 2 additions & 2 deletions test/runnable/linkdebug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ else
fi
libname=${dir}${SEP}libX${LIBEXT}

$DMD -m${MODEL} -I${src} -of${libname} -lib ${src}${SEP}linkdebug_uni.d ${src}${SEP}linkdebug_range.d ${src}${SEP}linkdebug_primitives.d || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${libname} -lib ${src}${SEP}linkdebug_uni.d ${src}${SEP}linkdebug_range.d ${src}${SEP}linkdebug_primitives.d || exit 1

$DMD -m${MODEL} -I${src} -of${dir}${SEP}linkdebug${EXE} -g -debug ${src}${SEP}linkdebug.d ${libname} || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}linkdebug${EXE} -g -debug ${src}${SEP}linkdebug.d ${libname} || exit 1

rm ${libname}
rm ${dir}/{linkdebug${OBJ},linkdebug${EXE}}
Expand Down
4 changes: 2 additions & 2 deletions test/runnable/test10386.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ else
fi
libname=${dir}${SEP}lib10386${LIBEXT}

$DMD -m${MODEL} -Irunnable -I${src} -of${libname} -c ${src}${SEP}lib10386${SEP}foo${SEP}bar.d ${src}${SEP}lib10386${SEP}foo${SEP}package.d -lib || exit 1
$DMD -m${MODEL} -Irunnable -I${src} -of${dir}${SEP}test10386${EXE} ${src}${SEP}test10386.d ${libname} || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -Irunnable -I${src} -of${libname} -c ${src}${SEP}lib10386${SEP}foo${SEP}bar.d ${src}${SEP}lib10386${SEP}foo${SEP}package.d -lib || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -Irunnable -I${src} -of${dir}${SEP}test10386${EXE} ${src}${SEP}test10386.d ${libname} || exit 1

rm ${dir}/{lib10386${LIBEXT},test10386${OBJ},test10386${EXE}}

Expand Down
4 changes: 2 additions & 2 deletions test/runnable/test10567.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ src=runnable${SEP}extra-files
dir=${RESULTS_DIR}${SEP}runnable
output_file=${dir}/test10567.sh.out

$DMD -m${MODEL} -I${src} -of${dir}${SEP}test10567a${OBJ} -c ${src}${SEP}test10567a.d || exit 1
$DMD -m${MODEL} -I${src} -of${dir}${SEP}test10567${EXE} ${src}${SEP}test10567.d ${dir}${SEP}test10567a${OBJ} || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}test10567a${OBJ} -c ${src}${SEP}test10567a.d || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}test10567${EXE} ${src}${SEP}test10567.d ${dir}${SEP}test10567a${OBJ} || exit 1
${RESULTS_DIR}/runnable/test10567${EXE} || exit 1

rm ${dir}/{test10567a${OBJ},test10567${EXE}}
Expand Down
4 changes: 2 additions & 2 deletions test/runnable/test13666.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ else
fi
libname=${dir}${SEP}lib13666${LIBEXT}

$DMD -m${MODEL} -I${src} -of${libname} -lib ${src}${SEP}lib13666.d || exit 1
$DMD -m${MODEL} -I${src} -of${dir}${SEP}test13666${EXE} ${src}${SEP}test13666.d ${libname} || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${libname} -lib ${src}${SEP}lib13666.d || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}test13666${EXE} ${src}${SEP}test13666.d ${libname} || exit 1

rm ${dir}/{lib13666${LIBEXT},test13666${OBJ},test13666${EXE}}

Expand Down
2 changes: 1 addition & 1 deletion test/runnable/test2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ a[3]='-debug=2 -debug=bar'
for x in "${a[@]}"; do
echo "executing with args: $x" >> ${output_file}

$DMD -m${MODEL} $x -unittest -od${dmddir} -of${dmddir}${SEP}test2${EXE} runnable/extra-files/test2.d >> ${output_file}
$DMD -m${MODEL} ${PIC_FLAG} $x -unittest -od${dmddir} -of${dmddir}${SEP}test2${EXE} runnable/extra-files/test2.d >> ${output_file}
if [ $? -ne 0 ]; then
cat ${output_file}
rm -f ${output_file}
Expand Down
6 changes: 3 additions & 3 deletions test/runnable/test35.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ output_file=${dir}/test35.sh.out

rm -f ${output_file}

$DMD -m${MODEL} -Irunnable -od${dmddir} -c runnable/extra-files/test35.d >> ${output_file}
$DMD -m${MODEL} ${PIC_FLAG} -Irunnable -od${dmddir} -c runnable/extra-files/test35.d >> ${output_file}
if [ $? -ne 0 ]; then
cat ${output_file}
rm -f ${output_file}
exit 1
fi

$DMD -m${MODEL} -od${dmddir} -c -release runnable/imports/test35a.d >> ${output_file}
$DMD -m${MODEL} ${PIC_FLAG} -od${dmddir} -c -release runnable/imports/test35a.d >> ${output_file}
if [ $? -ne 0 ]; then
cat ${output_file}
rm -f ${output_file}
exit 1
fi

$DMD -m${MODEL} -of${dmddir}${SEP}test35${EXE} ${dir}/test35${OBJ} ${dir}/test35a${OBJ} >> ${output_file}
$DMD -m${MODEL} ${PIC_FLAG} -of${dmddir}${SEP}test35${EXE} ${dir}/test35${OBJ} ${dir}/test35a${OBJ} >> ${output_file}
if [ $? -ne 0 ]; then
cat ${output_file}
rm -f ${output_file}
Expand Down
8 changes: 4 additions & 4 deletions test/runnable/test39.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ output_file=${dir}/test39.sh.out

rm -f ${output_file}

$DMD -m${MODEL} -Irunnable -od${dmddir} -c runnable/extra-files/test39.d >> ${output_file}
$DMD -m${MODEL} ${PIC_FLAG} -Irunnable -od${dmddir} -c runnable/extra-files/test39.d >> ${output_file}
if [ $? -ne 0 ]; then
cat ${output_file}
rm -f ${output_file}
exit 1
fi

$DMD -m${MODEL} -Irunnable -od${dmddir} -c runnable/imports/test39a.d >> ${output_file}
$DMD -m${MODEL} ${PIC_FLAG} -Irunnable -od${dmddir} -c runnable/imports/test39a.d >> ${output_file}
if [ $? -ne 0 ]; then
cat ${output_file}
rm -f ${output_file}
exit 1
fi

if [ ${OS} == "win32" -o ${OS} == "win64" ]; then
$DMD -m${MODEL} -lib -of${dmddir}${SEP}test39a.lib ${dmddir}${SEP}test39a.obj >> ${output_file} 2>&1
$DMD -m${MODEL} ${PIC_FLAG} -lib -of${dmddir}${SEP}test39a.lib ${dmddir}${SEP}test39a.obj >> ${output_file} 2>&1
LIBEXT=.lib
else
ar -r ${dir}/test39a.a ${dir}/test39a.o >> ${output_file} 2>&1
Expand All @@ -33,7 +33,7 @@ if [ $? -ne 0 ]; then
exit 1
fi

$DMD -m${MODEL} -of${dmddir}${SEP}test39${EXE} ${dir}/test39${OBJ} ${dir}/test39a${LIBEXT} >> ${output_file}
$DMD -m${MODEL} ${PIC_FLAG} -of${dmddir}${SEP}test39${EXE} ${dir}/test39${OBJ} ${dir}/test39a${LIBEXT} >> ${output_file}
if [ $? -ne 0 ]; then
cat ${output_file}
rm -f ${output_file}
Expand Down
4 changes: 2 additions & 2 deletions test/runnable/test44.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ output_file=${dir}/test44.sh.out

rm -f ${output_file}

$DMD -m${MODEL} -Irunnable -od${dmddir} -of${dmddir}${SEP}test44_1${EXE} runnable/extra-files/test44.d runnable/imports/test44a.d >> ${output_file}
$DMD -m${MODEL} ${PIC_FLAG} -Irunnable -od${dmddir} -of${dmddir}${SEP}test44_1${EXE} runnable/extra-files/test44.d runnable/imports/test44a.d >> ${output_file}
if [ $? -ne 0 ]; then
cat ${output_file}
rm -f ${output_file}
Expand All @@ -20,7 +20,7 @@ if [ $? -ne 0 ]; then
exit 1
fi

$DMD -m${MODEL} -Irunnable -od${dmddir} -of${dmddir}${SEP}test44_2${EXE} runnable/imports/test44a.d runnable/extra-files/test44.d >> ${output_file}
$DMD -m${MODEL} ${PIC_FLAG} -Irunnable -od${dmddir} -of${dmddir}${SEP}test44_2${EXE} runnable/imports/test44a.d runnable/extra-files/test44.d >> ${output_file}
if [ $? -ne 0 ]; then
cat ${output_file}
rm -f ${output_file}
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/test9287.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dir=${RESULTS_DIR}${SEP}runnable
output_file=${dir}/test9287.sh.out

echo 'import std.stdio; void main() { writeln("Success"); }' | \
$DMD -m${MODEL} -of${dir}${SEP}test9287a${EXE} - || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -of${dir}${SEP}test9287a${EXE} - || exit 1

${RESULTS_DIR}/runnable/test9287a${EXE} > ${output_file}

Expand Down
4 changes: 2 additions & 2 deletions test/runnable/test9377.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ else
fi
libname=${dir}${SEP}lib9377${LIBEXT}

$DMD -m${MODEL} -I${src} -of${libname} -c ${src}${SEP}mul9377a.d ${src}${SEP}mul9377b.d -lib || exit 1
$DMD -m${MODEL} -I${src} -of${dir}${SEP}mul9377${EXE} ${src}${SEP}multi9377.d ${libname} || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${libname} -c ${src}${SEP}mul9377a.d ${src}${SEP}mul9377b.d -lib || exit 1
$DMD -m${MODEL} ${PIC_FLAG} -I${src} -of${dir}${SEP}mul9377${EXE} ${src}${SEP}multi9377.d ${libname} || exit 1

rm ${dir}/{lib9377${LIBEXT},mul9377${OBJ},mul9377${EXE}}

Expand Down
Loading