[lld] r204296 - Move RoundTrip tests behind LLVM_RUN_ROUNDTRIP_TEST env flag.

Rui Ueyama ruiu at google.com
Wed Mar 19 19:49:33 PDT 2014


Author: ruiu
Date: Wed Mar 19 21:49:33 2014
New Revision: 204296

URL: http://llvm.org/viewvc/llvm-project?rev=204296&view=rev
Log:
Move RoundTrip tests behind LLVM_RUN_ROUNDTRIP_TEST env flag.

If the environment variable is defined and not empty, RoundTrip tests
are run. The reason to move the tests behind the flag is because they
are too slow to enable by default.

LLD linking time on llvm-tblgen improved from 2m7s to 2.3s. About 60x
faster now in this case.

Differential Revision: http://llvm-reviews.chandlerc.com/D3126

Modified:
    lld/trunk/lib/Driver/Driver.cpp
    lld/trunk/test/lit.cfg

Modified: lld/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=204296&r1=204295&r2=204296&view=diff
==============================================================================
--- lld/trunk/lib/Driver/Driver.cpp (original)
+++ lld/trunk/lib/Driver/Driver.cpp Wed Mar 19 21:49:33 2014
@@ -25,6 +25,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/Process.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include <mutex>
@@ -119,8 +120,11 @@ bool Driver::link(LinkingContext &contex
   context.addPasses(pm);
 
 #ifndef NDEBUG
-  pm.add(std::unique_ptr<Pass>(new RoundTripYAMLPass(context)));
-  pm.add(std::unique_ptr<Pass>(new RoundTripNativePass(context)));
+  llvm::Optional<std::string> env = llvm::sys::Process::GetEnv("LLD_RUN_ROUNDTRIP_TEST");
+  if (env.hasValue() && !env.getValue().empty()) {
+    pm.add(std::unique_ptr<Pass>(new RoundTripYAMLPass(context)));
+    pm.add(std::unique_ptr<Pass>(new RoundTripNativePass(context)));
+  }
 #endif
 
   pm.runOnFile(merged);

Modified: lld/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/lit.cfg?rev=204296&r1=204295&r2=204296&view=diff
==============================================================================
--- lld/trunk/test/lit.cfg (original)
+++ lld/trunk/test/lit.cfg Wed Mar 19 21:49:33 2014
@@ -27,6 +27,9 @@ config.suffixes = ['.objtxt', '.test']
 # test_source_root: The root path where tests are located.
 config.test_source_root = os.path.dirname(__file__)
 
+# run RoundTrip{YAML,Native}Tests.
+config.environment['LLD_RUN_ROUNDTRIP_TEST'] = '1'
+
 # test_exec_root: The root path where tests should be run.
 lld_obj_root = getattr(config, 'lld_obj_root', None)
 if lld_obj_root is not None:





More information about the llvm-commits mailing list