# backward compatibility
TESTCASE_PTS=${TEST}.pts
+DEBUG=1
+
# HOOKS
# TESTCASE_HOOKS
if in_type == "file":
in_name = e["IN_NAME"]
e.log.verbose("Input file: %s (copied from %s)\n" % (in_name, os.path.join(e["PDIR"], inn)))
- shutil.copyfile(os.path.join(tdir, inn), os.path.join(boxdir, in_name))
+ try:
+ shutil.copyfile(os.path.join(tdir, inn), os.path.join(boxdir, in_name))
+ except IOError:
+ raise moe.MoeError, "Input file not found"
if not is_interactive:
sandbox_opts += " -i/dev/null"
elif in_type == "stdio":
e.log.verbose("Input file: <stdin> (copied from %s)\n" % os.path.join(e["PDIR"], inn))
- shutil.copyfile(os.path.join(tdir, inn), os.path.join(boxdir, ".stdin"))
+ try:
+ shutil.copyfile(os.path.join(tdir, inn), os.path.join(boxdir, ".stdin"))
+ except IOError:
+ raise moe.MoeError, "Input file not found"
sandbox_opts += " -i.stdin"
elif in_type == "none":
e.log.verbose("Input file: <none>\n")
import sys
import os
+import traceback
-progress_file = os.fdopen(os.dup(1), "w", 0)
+orig_stdout_fd = os.dup(1)
+orig_stderr_fd = os.dup(2)
+progress_file = os.fdopen(orig_stdout_fd, "w", 0)
class MoeLog:
self.log_file.flush()
default = MoeLog()
+
+def fatal_exception():
+ os.dup2(orig_stderr_fd, 2)
+ traceback.print_exc()
+ sys.exit(1)
import moe.eval
import moe.log
import shutil
+import traceback
def configure_test(e, test):
e.cfgs = moe.config.MoeConfigStack(e.cfgs)
run_test(e, test)
except moe.MoeError, err:
raise moe.TestError(err, "XX")
+ except Exception:
+ if e["DEBUG"]:
+ moe.log.fatal_exception()
+ traceback.print_exc(file = e.log.log_file)
+ raise moe.TestError("Internal exception", "XX")
def conclude_test(e):
stat = e.test_stat
import moe.eval
import moe.pipeline
import moe.batch
+import os
e = moe.eval.Eval()
except moe.SolutionError, err:
e.stat["error"] = err
e.log.shout("%s\n" % err)
+except Exception:
+ moe.log.fatal_exception()
moe.log.default.progress_file.write("\nFinal status file:\n")
e.stat.write(file=moe.log.default.progress_file)