def testCrash(self): filename = "./testFiles/slha/gluino_squarks.slha" ctr = 0 crash_file = None self.cleanUp() outputfile = runMain(filename, timeout=1, suppressStdout=True, inifile="timeout.ini") try: ## trying to sync!! import ctypes libc = ctypes.CDLL("libc.so.6") libc.sync() except (OSError, AttributeError, ImportError) as e: pass time.sleep(.1) for f in os.listdir("."): if ".crash" in f: crash_file = f ctr += 1 self.assertEqual(ctr, 1) inp, par = crashReport.readCrashReportFile(crash_file) with open(filename) as f: with open(inp) as g: self.assertEqual(f.readlines(), g.readlines()) with open("timeout.ini") as f: with open(par) as g: self.assertEqual(f.readlines(), g.readlines()) self.cleanUp()
def testCrash(self): filename = "./testFiles/slha/gluino_squarks.slha" ctr=0 crash_file = None self.cleanUp() outputfile = runMain(filename, timeout=1, suppressStdout=True, inifile= "timeout.ini" ) try: ## trying to sync!! import ctypes libc = ctypes.CDLL("libc.so.6") libc.sync() except (OSError,AttributeError,ImportError) as e: pass time.sleep(.1) for f in os.listdir("."): if ".crash" in f: crash_file = f ctr+=1 self.assertEqual ( ctr, 1 ) inp, par = crashReport.readCrashReportFile(crash_file) with open(filename) as f: with open(inp) as g: self.assertEqual(f.readlines(), g.readlines()) with open("timeout.ini") as f: with open(par) as g: self.assertEqual( f.readlines(), g.readlines()) self.cleanUp()
def main(): import argparse """ Set default input and output files """ parameterFile = "%s/smodels/etc/parameters_default.ini" % installDirectory() outputDir = "./results/" """ Get the name of input SLHA file and parameter file """ ap = argparse.ArgumentParser( description= "Run SModelS over SLHA/LHE input files." ) ap.add_argument('-f', '--filename', help='name of SLHA or LHE input file or a directory path (required argument). ' 'If a directory is given, loop over all files in the directory', required=True) ap.add_argument('-p', '--parameterFile', help='name of parameter file, where most options are defined (optional argument). If not set, use ' 'all parameters from smodels/etc/parameters_default.ini', default=parameterFile) ap.add_argument('-o', '--outputDir', help='name of output directory (optional argument). The default folder is: ' + outputDir, default=outputDir) ap.add_argument('-d', '--development', help='if set, SModelS will run in development mode and exit if any errors are found.', action='store_true') ap.add_argument('-t', '--force_txt', help='force loading the text database', action='store_true') ap.add_argument('-C', '--colors', help='colored output', action='store_true') ap.add_argument('-V', '--version', action='version', version = version() ) ap.add_argument('-c', '--run-crashreport', help='parse crash report file and use its contents for a SModelS run. ' "Supply the crash file simply via '--filename myfile.crash'", action='store_true') ap.add_argument('-v','--verbose', help='sets the verbosity level (debug, info, warning, error). Default value is info.', default = "info", type = str ) ap.add_argument('-T', '--timeout', help='define a limit on the running time (in secs).' 'If not set, run without a time limit. If a directory is given as input, ' 'the timeout will be applied for each individual file.', default = 0, type = int) args = ap.parse_args() if args.colors: from smodels.tools.colors import colors colors.on = True db=None if args.force_txt: db=True smodelsLogging.setLogLevel ( args.verbose ) if args.run_crashreport: args.filename, args.parameterFile = crashReport.readCrashReportFile( args.filename) run(args.filename, args.parameterFile, args.outputDir, db, args.timeout, development=True ) else: run(args.filename, args.parameterFile, args.outputDir, db, args.timeout, args.development)
def main(): import argparse """ Set default input and output files """ parameterFile = "%s/smodels/etc/parameters_default.ini" % installDirectory( ) outputDir = "./results/" """ Get the name of input SLHA file and parameter file """ ap = argparse.ArgumentParser( description="Run SModelS over SLHA/LHE input files.") ap.add_argument( '-f', '--filename', help= 'name of SLHA or LHE input file or a directory path (required argument). ' 'If a directory is given, loop over all files in the directory', required=True) ap.add_argument( '-p', '--parameterFile', help= 'name of parameter file, where most options are defined (optional argument). If not set, use ' 'all parameters from smodels/etc/parameters_default.ini', default=parameterFile) ap.add_argument( '-o', '--outputDir', help= 'name of output directory (optional argument). The default folder is: ' + outputDir, default=outputDir) ap.add_argument( '-d', '--development', help= 'if set, SModelS will run in development mode and exit if any errors are found.', action='store_true') ap.add_argument('-t', '--force_txt', help='force loading the text database', action='store_true') ap.add_argument('-C', '--colors', help='colored output', action='store_true') ap.add_argument('-V', '--version', action='version', version=version()) ap.add_argument( '-c', '--run-crashreport', help='parse crash report file and use its contents for a SModelS run. ' "Supply the crash file simply via '--filename myfile.crash'", action='store_true') ap.add_argument( '-v', '--verbose', help= 'sets the verbosity level (debug, info, warning, error). Default value is info.', default="info", type=str) ap.add_argument( '-T', '--timeout', help='define a limit on the running time (in secs).' 'If not set, run without a time limit. If a directory is given as input, ' 'the timeout will be applied for each individual file.', default=0, type=int) args = ap.parse_args() if args.colors: from smodels.tools.colors import colors colors.on = True db = None if args.force_txt: db = True smodelsLogging.setLogLevel(args.verbose) if args.run_crashreport: args.filename, args.parameterFile = crashReport.readCrashReportFile( args.filename) run(args.filename, args.parameterFile, args.outputDir, db, args.timeout, development=True) else: run(args.filename, args.parameterFile, args.outputDir, db, args.timeout, args.development)
help='define a limit on the running time (in secs).' 'If not set, run without a time limit. If a directory is given as input, ' 'the timeout will be applied for each individual file.', default=0, type=int) ap.add_argument('-particles', '--particlePath', help='path to directory where particles.py is located', default=installDirectory() + "/smodels") args = ap.parse_args() db = None if args.force_txt: db = True smodelsLogging.setLogLevel(args.verbose) if args.run_crashreport: args.filename, args.parameterFile = crashReport.readCrashReportFile( args.filename) main(args.filename, args.parameterFile, args.outputDir, db, args.timeout, development=True, particlePath=args.particlePath) else: main(args.filename, args.parameterFile, args.outputDir, db, args.timeout, args.development, args.particlePath)