diff options
| author | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-12-28 21:48:09 +0100 |
|---|---|---|
| committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-12-29 10:26:33 +0100 |
| commit | 67f9af628e3b3ccb68eecfeb79fe7c31c1497682 (patch) | |
| tree | e99bf8bcf40c2ea20c15d023534deb3768f4aefe /test/suite/test.sh | |
| parent | 3294ff2f9b7aa92b6dccc653c590ce27fa434f8c (diff) | |
WIPsuite_on_cpp
Diffstat (limited to 'test/suite/test.sh')
| -rwxr-xr-x | test/suite/test.sh | 118 |
1 files changed, 1 insertions, 117 deletions
diff --git a/test/suite/test.sh b/test/suite/test.sh index c54137a..4638c0d 100755 --- a/test/suite/test.sh +++ b/test/suite/test.sh @@ -1,120 +1,4 @@ #!/bin/bash : ${CXX:=g++} -: ${CTORDIR:=../../build} -: ${BUILDDIR:=build} -CXX=$(which $CXX) - -function fail -{ - echo "*** Failure at line $1" - exit 1 -} - -function ctor -{ - echo "*** Running: ./ctor $*" - ./ctor $* -} - -STAT_FORMAT="-c %Y" -if [[ "$OSTYPE" == "darwin"* ]]; then - # Mac OSX - STAT_FORMAT="-f %B" -fi - -# Wipe the board -rm -Rf ${BUILDDIR} -rm -f configuration.cc -rm -f ctor - -echo "** ctor_files/ctor.cc.base" -cp ctor_files/ctor.cc.base ctor.cc - -# Compile bootstrap binary -$CXX -pthread $LDFLAGS $CXXFLAGS -std=c++20 -L${CTORDIR} -lctor -I../../src ctor.cc -o ctor || fail ${LINENO} - -# No build files should have been created yet -[ -d ${BUILDDIR} ] && fail ${LINENO} - -# capture md5 sum of ctor binary before configure is called -MD5=`md5sum ctor` -ctor configure --ctor-includedir ../../src --ctor-libdir=${CTORDIR} --build-dir=${BUILDDIR} - -# ctor should be rebuilt at this point, so md5 sum should have changed -(echo $MD5 | md5sum --status -c) && fail ${LINENO} - -# configuration.cc should have been generated now -[ ! -f configuration.cc ] && fail ${LINENO} - -# Shouldn't compile anything yet - only configure -[ -f ${BUILDDIR}/hello-hello_cc.o ] && fail ${LINENO} - -MD5=`md5sum ctor` - -# Run normally to build project -ctor -v - -# Compiled object should now exist -[ ! -f ${BUILDDIR}/hello-hello_cc.o ] && fail ${LINENO} - -# ctor should not have been rebuilt, so md5 sum should be the same -(echo $MD5 | md5sum --status -c) || fail ${LINENO} - -MOD1=`stat $STAT_FORMAT ${BUILDDIR}/hello-hello_cc.o` -touch hello.cc -sleep 1.1 - -# Run normally to rebuild hello.cc -ctor -v - -# Object file should have been recompiled -MOD2=`stat $STAT_FORMAT ${BUILDDIR}/hello-hello_cc.o` -[[ $MOD1 == $MOD2 ]] && fail ${LINENO} - -# Replacve -DFOO with -DBAR in foo external.cxxflags -echo "** ctor_files/ctor.cc.bar" -cp ctor_files/ctor.cc.bar ctor.cc - -MD5C=`md5sum configuration.cc` -MD5=`md5sum ctor` -MOD1=`stat $STAT_FORMAT build/hello-hello_cc.o` -sleep 1.1 - -# Run normally to reconfigure, rebuild ctor and rebuild hello.cc -ctor -v - -MOD2=`stat $STAT_FORMAT ${BUILDDIR}/hello-hello_cc.o` -[[ $MOD1 == $MOD2 ]] && fail ${LINENO} -(echo $MD5C | md5sum --status -c) && fail ${LINENO} -(echo $MD5 | md5sum --status -c) && fail ${LINENO} - -echo "** ctor_files/ctor.cc.multi" -cp ctor_files/ctor.cc.multi ctor.cc - -MD5C=`md5sum configuration.cc` -MD5=`md5sum ctor` -MOD1=`stat $STAT_FORMAT ${BUILDDIR}/hello-hello_cc.o` -sleep 1.1 - -# Run normally to reconfigure, rebuild ctor and rebuild hello.cc -ctor -v - -MOD2=`stat $STAT_FORMAT ${BUILDDIR}/hello-hello_cc.o` -[[ $MOD1 == $MOD2 ]] && fail ${LINENO} -(echo $MD5C | md5sum --status -c) && fail ${LINENO} -(echo $MD5 | md5sum --status -c) && fail ${LINENO} - -# now touching foobar.h, should retrigger re-configuration -touch foobar.h - -MOD1=`stat $STAT_FORMAT ctor` -sleep 1.1 - -# Run normally to reconfigure, rebuild ctor and rebuild hello.cc -ctor -v - -MOD2=`stat $STAT_FORMAT ctor` -[[ $MOD1 == $MOD2 ]] && fail ${LINENO} - -exit 0 +$CXX $LDFLAGS $CXXFLAGS -std=c++20 -Wall test.cc -o test && ./test |
