diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/suite/ctor_files/ctor.cc.bar | 16 | ||||
| -rw-r--r-- | test/suite/ctor_files/ctor.cc.base | 17 | ||||
| -rw-r--r-- | test/suite/ctor_files/ctor.cc.multi | 16 | ||||
| -rwxr-xr-x | test/suite/test.sh | 32 | 
4 files changed, 49 insertions, 32 deletions
diff --git a/test/suite/ctor_files/ctor.cc.bar b/test/suite/ctor_files/ctor.cc.bar index d63b5e8..218f9cc 100644 --- a/test/suite/ctor_files/ctor.cc.bar +++ b/test/suite/ctor_files/ctor.cc.bar @@ -6,7 +6,7 @@  namespace  { -BuildConfigurations ctorConfigs() +ctor::build_configurations ctorConfigs(const ctor::settings& settings)  {  	return  	{ @@ -30,17 +30,19 @@ BuildConfigurations ctorConfigs()  	};  } -ExternalConfigurations ctorExtConfigs() +ctor::external_configurations ctorExtConfigs(const ctor::settings& settings)  {  	return  	{  		{  			.name = "bar", -			.flags = { -				.cxxflags = { "-D_A_", "-DBAR"}, -				.cflags = { "-D_B_" }, -				.ldflags = { "-D_C_" }, -				.asmflags = { "-D_D_" }, +			.external = ctor::external_manual{ +				.flags = { +					.cflags = { "-D_B_" }, +					.cxxflags = { "-D_A_", "-DBAR"}, +					.ldflags = { "-D_C_" }, +					.asmflags = { "-D_D_" }, +				},  			},  			// Creates --with-foo-prefix arg to configure which will be used for  			// -L and -I flags. diff --git a/test/suite/ctor_files/ctor.cc.base b/test/suite/ctor_files/ctor.cc.base index 3de099d..eab39c4 100644 --- a/test/suite/ctor_files/ctor.cc.base +++ b/test/suite/ctor_files/ctor.cc.base @@ -6,7 +6,7 @@  namespace  { -BuildConfigurations ctorConfigs() +ctor::build_configurations ctorConfigs(const ctor::settings& settings)  {  	return  	{ @@ -30,17 +30,20 @@ BuildConfigurations ctorConfigs()  	};  } -ExternalConfigurations ctorExtConfigs() +ctor::external_configurations ctorExtConfigs(const ctor::settings& settings)  {  	return  	{  		{  			.name = "bar", -			.flags = { -				.cxxflags = { "-D_A_", "-DFOO"}, -				.cflags = { "-D_B_" }, -				.ldflags = { "-D_C_" }, -				.asmflags = { "-D_D_" }, +			.external = ctor::external_manual +			{ +				.flags = { +					.cflags = { "-D_B_" }, +					.cxxflags = { "-D_A_", "-DFOO"}, +					.ldflags = { "-D_C_" }, +					.asmflags = { "-D_D_" }, +				},  			},  			// Creates --with-foo-prefix arg to configure which will be used for  			// -L and -I flags. diff --git a/test/suite/ctor_files/ctor.cc.multi b/test/suite/ctor_files/ctor.cc.multi index d18d0d5..2b88afe 100644 --- a/test/suite/ctor_files/ctor.cc.multi +++ b/test/suite/ctor_files/ctor.cc.multi @@ -8,7 +8,7 @@  namespace  { -BuildConfigurations ctorConfigs() +ctor::build_configurations ctorConfigs(const ctor::settings& settings)  {  	return  	{ @@ -32,17 +32,19 @@ BuildConfigurations ctorConfigs()  	};  } -ExternalConfigurations ctorExtConfigs() +ctor::external_configurations ctorExtConfigs(const ctor::settings& settings)  {  	return  	{  		{  			.name = "bar", -			.flags = { -				.cxxflags = { "-D_A_", "-DFOO"}, -				.cflags = { "-D_B_" }, -				.ldflags = { "-D_C_" }, -				.asmflags = { "-D_D_" }, +			.external = ctor::external_manual{ +				.flags = { +					.cflags = { "-D_B_" }, +					.cxxflags = { "-D_A_", "-DFOO"}, +					.ldflags = { "-D_C_" }, +					.asmflags = { "-D_D_" }, +				},  			},  			// Creates --with-foo-prefix arg to configure which will be used for  			// -L and -I flags. diff --git a/test/suite/test.sh b/test/suite/test.sh index c980154..c112351 100755 --- a/test/suite/test.sh +++ b/test/suite/test.sh @@ -1,4 +1,9 @@  #!/bin/bash +: ${CXX:=g++} +: ${CTORDIR:=../../build} +: ${BUILDDIR:=build} + +CXX=$(which $CXX)  function fail  { @@ -13,21 +18,22 @@ function ctor  }  # Wipe the board -rm -Rf build +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 -g++ -pthread -std=c++20 -L../../build -lctor -I../../src ctor.cc -o ctor || fail ${LINENO} +$CXX -pthread -std=c++20 -L${CTORDIR} -lctor -I../../src ctor.cc -o ctor || fail ${LINENO}  # No build files should have been created yet -[ -d build ] && fail ${LINENO} +[ -d ${BUILDDIR} ] && fail ${LINENO}  # capture md5 sum of ctor binary before configure is called  MD5=`md5sum ctor` -ctor configure --ctor-includedir ../../src --ctor-libdir ../../build +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} @@ -36,7 +42,7 @@ ctor configure --ctor-includedir ../../src --ctor-libdir ../../build  [ ! -f configuration.cc ] && fail ${LINENO}  # Shouldn't compile anything yet - only configure -[ -f build/hello-hello_cc.o ] && fail ${LINENO} +[ -f ${BUILDDIR}/hello-hello_cc.o ] && fail ${LINENO}  MD5=`md5sum ctor` @@ -44,12 +50,12 @@ MD5=`md5sum ctor`  ctor -v  # Compiled object should now exist -[ ! -f build/hello-hello_cc.o ] && fail ${LINENO} +[ ! -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 -c %Y build/hello-hello_cc.o` +MOD1=`stat -c %Y ${BUILDDIR}/hello-hello_cc.o`  touch hello.cc  sleep 1.1 @@ -57,10 +63,11 @@ sleep 1.1  ctor -v  # Object file should have been recompiled -MOD2=`stat -c %Y build/hello-hello_cc.o` +MOD2=`stat -c %Y ${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` @@ -71,22 +78,23 @@ sleep 1.1  # Run normally to reconfigure, rebuild ctor and rebuild hello.cc  ctor -v -MOD2=`stat -c %Y build/hello-hello_cc.o` +MOD2=`stat -c %Y ${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 -c %Y build/hello-hello_cc.o` +MOD1=`stat -c %Y ${BUILDDIR}/hello-hello_cc.o`  sleep 1.1  # Run normally to reconfigure, rebuild ctor and rebuild hello.cc  ctor -v -MOD2=`stat -c %Y build/hello-hello_cc.o` +MOD2=`stat -c %Y ${BUILDDIR}/hello-hello_cc.o`  [[ $MOD1 == $MOD2 ]] && fail ${LINENO}  (echo $MD5C | md5sum --status -c) && fail ${LINENO}  (echo $MD5 | md5sum --status -c) && fail ${LINENO} @@ -102,3 +110,5 @@ ctor -v  MOD2=`stat -c %Y ctor`  [[ $MOD1 == $MOD2 ]] && fail ${LINENO} + +exit 0  | 
