From 0b6a81f6dfb5a9682b77ae6a65804356bd5f571c Mon Sep 17 00:00:00 2001 From: toole1 <toole1@6fbd10e7-183d-0410-a318-cb416676e4f2> Date: Sat, 25 Feb 2012 21:27:58 +0000 Subject: [PATCH] monad release 3.0.3 git-svn-id: https://subversion.cs.illinois.edu/svn/cs225@6162 6fbd10e7-183d-0410-a318-cb416676e4f2 --- source/monad_shared.cpp | 2 +- source/proxy.cpp | 2 +- source/proxy.h | 1 + source/util.cpp | 13 ++++++++++--- source/util.h | 15 +++++++++++++++ 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/source/monad_shared.cpp b/source/monad_shared.cpp index 8ad8480..1d4ce3f 100644 --- a/source/monad_shared.cpp +++ b/source/monad_shared.cpp @@ -15,7 +15,7 @@ namespace versioninfo { const char * official_name = "Monad Autograder"; const char * version_name = "mazecity"; -const Version version_num = Version(3, 0, 2); +const Version version_num = Version(3, 0, 3); const char * date = "31 Jan 2012"; } diff --git a/source/proxy.cpp b/source/proxy.cpp index 576300c..705d913 100644 --- a/source/proxy.cpp +++ b/source/proxy.cpp @@ -236,7 +236,7 @@ int32_t RunTests::run_single_test(const char * testname) if (strcmp(tests[test_i].name(), testname) == 0) return run_single_test(tests[test_i]); - cout << "Test not found" << endl; + cout << "Test '" << testname << "' not found" << endl; exit(-1); } diff --git a/source/proxy.h b/source/proxy.h index ab94aca..10194d3 100644 --- a/source/proxy.h +++ b/source/proxy.h @@ -405,6 +405,7 @@ TimeIterationsData timeIterationsImpl(Generator gen, Timer timeFunctor, Cleaner for (uint64_t genstart = util::process_clock(); max_iterations < max_gen_iterations && util::process_clock() - genstart < min_time; max_iterations++) inputs.push_back(new typename Generator::result_type(gen(input_size))); + // Make a temporary from the generator to be used to warm up the timeFunctor (in case it needs to initialize static variables, etc.) typename Generator::result_type warmup_temp = gen(1); timeFunctor(warmup_temp); // Warm up time functor (i.e. initialize statics) diff --git a/source/util.cpp b/source/util.cpp index 16b9180..6f4c31f 100644 --- a/source/util.cpp +++ b/source/util.cpp @@ -184,10 +184,11 @@ int8_t exec(const string & command, const vector<string> & args, ostream * outpu // Sanitize environment char path[] = "PATH=/bin/:/usr/bin:/usr/local/bin"; char libpath[] = "LD_LIBRARY_PATH=/software/intel-composer-2011u5-x86_64/lib/intel64/:$LD_LIBRARY_PATH"; // path for libiomp5.so + char licenses[] = "INTEL_LICENSE_FILE=28518@intel.webstore.illinois.edu:/software/intel-composer-2011u5-x86_64/composerxe-2011.5.220/licenses:/opt/intel/licenses:/home/massung1/intel/licenses"; // also for parallel labs // Turn off glibc errors default write-to-terminal behaviour, because // it does not get caught by stderr. This instead results in an abort. char redirect_glibc[] = "LIBC_FATAL_STDERR_=1"; - char * newenv[] = { path, libpath, redirect_glibc, NULL }; + char * newenv[] = { path, libpath, licenses, redirect_glibc, NULL }; environ = newenv; char ** args_cstr = cstr_array_from_vector_string(command, args); @@ -1001,13 +1002,19 @@ OptionsParser::OptionsParser() } vector<string> OptionsParser::parse(int argc, const char * const * argv) +{ + vector<string> rawArgs(argv, argv + argc); + return parse(rawArgs); +} + +vector<string> OptionsParser::parse(const vector<string> & rawArgs) { vector<string> unprocessedArgs; size_t out_arg_i = 0; - for (int arg_i = 1; arg_i < argc; arg_i++) + for (size_t arg_i = 1; arg_i < rawArgs.size(); arg_i++) { - string originalCaseArg = argv[arg_i]; + const string & originalCaseArg = rawArgs[arg_i]; string currarg = toLower(originalCaseArg); if (currarg.compare(0, 2, "--") == 0) //long option diff --git a/source/util.h b/source/util.h index 0df358c..bf501bb 100644 --- a/source/util.h +++ b/source/util.h @@ -102,6 +102,7 @@ class OptionsParser void addOption(const string & name, bool & setValue) { optsMap[name] = &setValue; } void addArg(string & setValue) { args.push_back(&setValue); } vector<string> parse(int argc, const char * const * argv); + vector<string> parse(const vector<string> & rawArgs); }; // EXEC() @@ -217,6 +218,20 @@ void readFileGeneric(const string & file, FileMap * map, vector<string> * lines, char * processOptions(int argc, char ** argv, OptionsMap & opts, vector<string> & args); +// Exceptions +class Exception : public std::exception +{ + private: + std::string message; + + public: + Exception(const std::string & _message) : message(_message) { } + virtual const char * what() const throw() { return message.c_str(); } + virtual ~Exception() throw() { } +}; + + + // AUTOGRADER -- GitLab