From d1641f09eba6bb99b7bae00d0fe3583bd7c58b4d Mon Sep 17 00:00:00 2001 From: TimQu Date: Wed, 20 Dec 2017 11:24:38 +0100 Subject: [PATCH] added a script to check multiple cmake configurations and updated the release checklist --- doc/checklist_new_release.md | 1 + doc/scripts/test_build_configurations.py | 118 ++++++++++++++++++++++ doc/scripts/test_build_configurations.txt | 5 + 3 files changed, 124 insertions(+) create mode 100644 doc/scripts/test_build_configurations.py create mode 100644 doc/scripts/test_build_configurations.txt diff --git a/doc/checklist_new_release.md b/doc/checklist_new_release.md index 5fda82ab5..05be534aa 100644 --- a/doc/checklist_new_release.md +++ b/doc/checklist_new_release.md @@ -13,6 +13,7 @@ Note that in most case a simultaneous release of [carl](https://github.com/smtra 3. Check that storm builds without errors and all tests are successful * [Travis](https://travis-ci.org/moves-rwth/storm) should run successfully + * Invoke the script test_build_configurations.py to build and check different cmake configurations 4. Set new storm version: * Set new storm version in `version.cmake` diff --git a/doc/scripts/test_build_configurations.py b/doc/scripts/test_build_configurations.py new file mode 100644 index 000000000..56baccf0d --- /dev/null +++ b/doc/scripts/test_build_configurations.py @@ -0,0 +1,118 @@ +import subprocess +import os +import shutil +import time +import math +import sys + +logfileDir = "test_build_configurations_logs" +pathToConfigFile = "" +globalCmakeArguments = "" +globalMakeArguments = "" + +if len(sys.argv) == 1 or len(sys.argv) > 5: + print "Usage: " + sys.argv[0] + "/path/to/storm /path/to/configurations.txt \"optional make arguments\" \"optional cmake arguments\"" + print "Example: " + sys.argv[0] + " ~/storm test_build_configurations.txt \"-j 48 -k\" \"-DZ3_ROOT=/path/to/z3/\"" + sys.exit(0) + +pathToStorm = sys.argv[1] +pathToConfigFile = sys.argv[2] + +if len(sys.argv) > 3: + globalMakeArguments = sys.argv[3] + print globalMakeArguments +if len(sys.argv) > 4: + globalCmakeArguments = sys.argv[4] + print globalCmakeArguments + +# create directory for log files +if not os.path.exists(logfileDir): + os.makedirs(logfileDir) + +unsuccessfulConfigs = "" +globalStartTime = time.time() + +with open(pathToConfigFile) as configfile: + localStartTime = time.time() + configId=0 + for localCmakeArguments in configfile: + + cmakeArguments = globalCmakeArguments + " " + localCmakeArguments.strip('\n') + buildDir = os.path.join(pathToStorm, "build{}".format(configId)) + logfilename = os.path.join(logfileDir, "build{}".format(configId) + "_" + time.strftime("%Y-%m-%d-%H-%M-%S") + ".log") + + + print "Building configuration {} with cmake options ".format(configId) + cmakeArguments + print "\tCreating log file " + logfilename + " ..." + with open(logfilename, "w") as logfile: + success=True + logfile.write("Log for test configuration " + cmakeArguments + "\n") + + print "\tCreating build directory" + buildDir + " ..." + if os.path.exists(buildDir): + print "\t\tRemoving existing directory " + buildDir + shutil.rmtree(buildDir, ignore_errors=True) + os.makedirs(buildDir) + logfile.write("Build directory is " + buildDir + "\n") + print "\t\tdone" + + if success: + print "\tInvoking cmake ..." + cmakeCommand = "cmake .. {}".format(cmakeArguments) + logfile.write ("\n\n CALLING CMAKE \n\n" + cmakeCommand + "\n") + try: + cmakeOutput = subprocess.check_output("cd " + buildDir + "; " + cmakeCommand , shell=True,stderr=subprocess.STDOUT) + print "\t\tdone" + logfile.write(cmakeOutput) + except subprocess.CalledProcessError as e: + success=False + print "\t\tfail" + print e.output + logfile.write(e.output) + + if success: + print "\tInvoking make ..." + makeCommand = "make {}".format(globalMakeArguments) + logfile.write ("\n\n CALLING MAKE \n\n" + makeCommand + "\n") + try: + makeOutput = subprocess.check_output("cd " + buildDir + "; " + makeCommand , shell=True,stderr=subprocess.STDOUT) + print "\t\tdone" + logfile.write(makeOutput) + except subprocess.CalledProcessError as e: + success=False + print "\t\tfail" + print e.output + logfile.write(e.output) + + if success: + print "\tInvoking make check..." + makeCheckCommand = "make check" + logfile.write ("\n\n CALLING MAKE CHECK \n\n" + makeCheckCommand + "\n") + try: + makeCheckOutput = subprocess.check_output("cd " + buildDir + "; " + makeCheckCommand , shell=True,stderr=subprocess.STDOUT) + print "\t\tdone" + logfile.write(makeCheckOutput) + except subprocess.CalledProcessError as e: + success=False + print "\t\tfail" + print e.output + logfile.write(e.output) + + localEndTime = time.time() + if success: + print "\tConfiguration build and tested successfully within {} minutes.".format(int((localEndTime - localStartTime)/60)) + else: + print "\tAn error occurred for this configuration." + unsuccessfulConfigs += buildDir + " with arguments " + cmakeArguments + "\n" + + configId += 1 +globalEndTime = time.time() +print "All tests completed after {} minutes.".format(int((globalEndTime - globalStartTime)/60)) +if unsuccessfulConfigs == "": + print "All configurations were build and tested successfully." +else: + print "The following configurations failed: \n" + unsuccessfulConfigs + + + + diff --git a/doc/scripts/test_build_configurations.txt b/doc/scripts/test_build_configurations.txt new file mode 100644 index 000000000..3688e8eab --- /dev/null +++ b/doc/scripts/test_build_configurations.txt @@ -0,0 +1,5 @@ +-DSTORM_USE_CLN_EA=OFF -DSTORM_USE_CLN_RF=OFF +-DSTORM_USE_CLN_EA=OFF -DSTORM_USE_CLN_RF=ON +-DSTORM_USE_CLN_EA=ON -DSTORM_USE_CLN_RF=OFF +-DSTORM_USE_CLN_EA=ON -DSTORM_USE_CLN_RF=ON +-DCMAKE_BUILD_TYPE=DEBUG -DSTORM_DEVELOPER=ON \ No newline at end of file