[llvm-commits] [zorg] r150597 - in /zorg/trunk/lnt/lnt: testing/util/misc.py tests/compile.py tests/nt.py
Daniel Dunbar
daniel at zuster.org
Wed Feb 15 10:01:25 PST 2012
Author: ddunbar
Date: Wed Feb 15 12:01:25 2012
New Revision: 150597
URL: http://llvm.org/viewvc/llvm-project?rev=150597&view=rev
Log:
[lnt] lnt.tests.compile: Require a sandbox directory for outputs (like lnt.tests.nt).
- This functionality should probably just be lifted to the Test base class.
Added:
zorg/trunk/lnt/lnt/testing/util/misc.py
Modified:
zorg/trunk/lnt/lnt/tests/compile.py
zorg/trunk/lnt/lnt/tests/nt.py
Added: zorg/trunk/lnt/lnt/testing/util/misc.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/testing/util/misc.py?rev=150597&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/testing/util/misc.py (added)
+++ zorg/trunk/lnt/lnt/testing/util/misc.py Wed Feb 15 12:01:25 2012
@@ -0,0 +1,4 @@
+import datetime
+
+def timestamp():
+ return datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
Modified: zorg/trunk/lnt/lnt/tests/compile.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/compile.py?rev=150597&r1=150596&r2=150597&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/tests/compile.py (original)
+++ zorg/trunk/lnt/lnt/tests/compile.py Wed Feb 15 12:01:25 2012
@@ -10,6 +10,7 @@
import lnt.testing.util.compilers
from lnt.testing.util.commands import note, warning, error, fatal
from lnt.testing.util.commands import capture, rm_f
+from lnt.testing.util.misc import timestamp
# Interface to runN.
#
@@ -204,8 +205,7 @@
def curry(fn, **kw_args):
return lambda *args: fn(*args, **kw_args)
-g_output_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)),
- 'Output')
+g_output_dir = None
all_inputs = [('Sketch/Sketch+Accessibility/SKTGraphicView.m', True, ()),
('403.gcc/combine.c', False, ('-DSPEC_CPU_MACOSX',))]
@@ -449,6 +449,9 @@
parser.add_option("-v", "--verbose", dest="verbose",
help="Show more test output",
action="store_true", default=False)
+ parser.add_option("-s", "--sandbox", dest="sandbox_path",
+ help="Parent directory to build and run tests in",
+ type=str, default=None, metavar="PATH")
group = OptionGroup(parser, "Test Options")
group.add_option("", "--cc", dest="cc", type='str',
@@ -499,9 +502,29 @@
parser.error("invalid number of arguments")
# Validate options.
+ if opts.sandbox_path is None:
+ parser.error('--sandbox is required')
if opts.test_suite_externals is None:
parser.error("--test-externals option is required")
+ # Set up the sandbox.
+ global g_output_dir
+ if not os.path.exists(opts.sandbox_path):
+ print >>sys.stderr, "%s: creating sandbox: %r" % (
+ timestamp(), opts.sandbox_path)
+ os.mkdir(opts.sandbox_path)
+ g_output_dir = os.path.join(os.path.abspath(opts.sandbox_path),
+ "test-%s" % (
+ timestamp().replace(' ','_').replace(':','-'),))
+ try:
+ os.mkdir(g_output_dir)
+ except OSError,e:
+ if e.errno == errno.EEXIST:
+ parser.error("sandbox output directory %r already exists!" % (
+ g_output_dir,))
+ else:
+ raise
+
# Collect machine and run information.
#
# FIXME: Include information on test source versions.
Modified: zorg/trunk/lnt/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/nt.py?rev=150597&r1=150596&r2=150597&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/tests/nt.py (original)
+++ zorg/trunk/lnt/lnt/tests/nt.py Wed Feb 15 12:01:25 2012
@@ -15,6 +15,7 @@
from lnt.testing.util.commands import note, warning, error, fatal
from lnt.testing.util.commands import capture, mkdir_p, which
from lnt.testing.util.rcs import get_source_version
+from lnt.testing.util.misc import timestamp
###
@@ -48,9 +49,6 @@
###
-def timestamp():
- return datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
-
def scan_for_test_modules(opts):
base_modules_path = os.path.join(opts.test_suite_root, 'LNTBased')
if opts.only_test is None:
More information about the llvm-commits
mailing list