[PATCH] Move RoundTrip tests behind LLVM_RUN_ROUNDTRIP_TEST env flag.

Rui Ueyama ruiu at google.com
Wed Mar 19 17:36:31 PDT 2014


Hi Bigcheese, shankarke, kledzik,

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.

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

Files:
  lib/Driver/Driver.cpp
  test/lit.cfg

Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -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 @@
   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);
Index: test/lit.cfg
===================================================================
--- test/lit.cfg
+++ test/lit.cfg
@@ -27,6 +27,9 @@
 # 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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3126.1.patch
Type: text/x-patch
Size: 1379 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140319/020a0588/attachment.bin>


More information about the llvm-commits mailing list