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
llvm-svn: 204296
diff --git a/lld/lib/Driver/Driver.cpp b/lld/lib/Driver/Driver.cpp
index 24e4ff9..cb2ec4d 100644
--- a/lld/lib/Driver/Driver.cpp
+++ b/lld/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);