From 60cce51f54078a1d10b02f138288d0888a8c707e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 6 Feb 2025 17:42:36 +0100 Subject: Add support for building on MacOSX --- Jenkinsfile | 21 +++++++++++++++++++++ test/suite/test.sh | 24 ++++++++++++++++-------- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 290f412..561d0cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,27 @@ pipeline { agent any stages { + //////////////////////////////////////////////////// + stage('MacOSX clang') { + agent { label 'macos' } + steps { + echo 'Cleaning workspace ...' + sh 'git clean -d -x -f' + echo 'Building (clang) ...' + sh 'CXX=/usr/local/opt/llvm/bin/clang++ LDFLAGS="-L/usr/local/opt/llvm/lib/c++ -L/usr/local/opt/llvm/lib/unwind -lunwind" ./bootstrap.sh' + echo 'Testing (clang) ...' + sh './ctor check' + echo 'Testing suite (clang) ...' + sh '(cd test/suite; CTORDIR=../../build CXX=/usr/local/opt/llvm/bin/clang++ LDFLAGS="-L/usr/local/opt/llvm/lib/c++ -L/usr/local/opt/llvm/lib/unwind -lunwind" ./test.sh)' + } + post { + always { + xunit(thresholds: [ skipped(failureThreshold: '0'), + failed(failureThreshold: '0') ], + tools: [ CppUnit(pattern: 'build/test/*.xml') ]) + } + } + } //////////////////////////////////////////////////// stage('Linux gcc') { agent { label 'linux && gcc && c++20' } diff --git a/test/suite/test.sh b/test/suite/test.sh index fe5d696..97d2551 100755 --- a/test/suite/test.sh +++ b/test/suite/test.sh @@ -17,6 +17,12 @@ function 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 @@ -55,7 +61,7 @@ ctor -v # ctor should not have been rebuilt, so md5 sum should be the same (echo $MD5 | md5sum --status -c) || fail ${LINENO} -MOD1=`stat -c %Y ${BUILDDIR}/hello-hello_cc.o` +MOD1=`stat $STAT_FORMAT ${BUILDDIR}/hello-hello_cc.o` touch hello.cc sleep 1.1 @@ -63,7 +69,9 @@ sleep 1.1 ctor -v # Object file should have been recompiled -MOD2=`stat -c %Y ${BUILDDIR}/hello-hello_cc.o` +MOD2=`stat $STAT_FORMAT ${BUILDDIR}/hello-hello_cc.o` +echo $MOD1 +echo $MOD2 [[ $MOD1 == $MOD2 ]] && fail ${LINENO} # Replacve -DFOO with -DBAR in foo external.cxxflags @@ -72,13 +80,13 @@ cp ctor_files/ctor.cc.bar ctor.cc MD5C=`md5sum configuration.cc` MD5=`md5sum ctor` -MOD1=`stat -c %Y build/hello-hello_cc.o` +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 -c %Y ${BUILDDIR}/hello-hello_cc.o` +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} @@ -88,13 +96,13 @@ cp ctor_files/ctor.cc.multi ctor.cc MD5C=`md5sum configuration.cc` MD5=`md5sum ctor` -MOD1=`stat -c %Y ${BUILDDIR}/hello-hello_cc.o` +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 -c %Y ${BUILDDIR}/hello-hello_cc.o` +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} @@ -102,13 +110,13 @@ MOD2=`stat -c %Y ${BUILDDIR}/hello-hello_cc.o` # now touching foobar.h, should retrigger re-configuration touch foobar.h -MOD1=`stat -c %Y ctor` +MOD1=`stat $STAT_FORMAT ctor` sleep 1.1 # Run normally to reconfigure, rebuild ctor and rebuild hello.cc ctor -v -MOD2=`stat -c %Y ctor` +MOD2=`stat $STAT_FORMAT ctor` [[ $MOD1 == $MOD2 ]] && fail ${LINENO} exit 0 -- cgit v1.2.3