[lld] r291210 - Use TarWriter to create tar archives instead of cpio.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 18:33:54 PST 2017


Author: ruiu
Date: Thu Jan  5 20:33:53 2017
New Revision: 291210

URL: http://llvm.org/viewvc/llvm-project?rev=291210&view=rev
Log:
Use TarWriter to create tar archives instead of cpio.

This is how we use TarWriter in LLD. Now LLD does not append
a file extension, so you need to pass `--reproduce foo.tar`
instead of `--reproduce foo`.

Differential Revision: https://reviews.llvm.org/D28103

Modified:
    lld/trunk/COFF/Driver.cpp
    lld/trunk/COFF/Driver.h
    lld/trunk/ELF/Driver.cpp
    lld/trunk/ELF/Driver.h
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/include/lld/Core/Reproduce.h
    lld/trunk/lib/Core/Reproduce.cpp
    lld/trunk/test/COFF/linkrepro.test
    lld/trunk/test/ELF/reproduce-backslash.s
    lld/trunk/test/ELF/reproduce-error.s
    lld/trunk/test/ELF/reproduce-linkerscript.s
    lld/trunk/test/ELF/reproduce-thin-archive.s
    lld/trunk/test/ELF/reproduce-windows.s
    lld/trunk/test/ELF/reproduce-windows2.s
    lld/trunk/test/ELF/reproduce.s
    lld/trunk/test/lit.cfg

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Thu Jan  5 20:33:53 2017
@@ -25,6 +25,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
+#include "llvm/Support/TarWriter.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
@@ -98,9 +99,9 @@ MemoryBufferRef LinkerDriver::takeBuffer
   MemoryBufferRef MBRef = *MB;
   OwningMBs.push_back(std::move(MB));
 
-  if (Driver->Cpio)
-    Driver->Cpio->append(relativeToRoot(MBRef.getBufferIdentifier()),
-                         MBRef.getBuffer());
+  if (Driver->Tar)
+    Driver->Tar->append(relativeToRoot(MBRef.getBufferIdentifier()),
+                        MBRef.getBuffer());
 
   return MBRef;
 }
@@ -458,13 +459,17 @@ void LinkerDriver::link(ArrayRef<const c
 
   if (auto *Arg = Args.getLastArg(OPT_linkrepro)) {
     SmallString<64> Path = StringRef(Arg->getValue());
-    sys::path::append(Path, "repro");
-    ErrorOr<CpioFile *> F = CpioFile::create(Path);
-    if (F)
-      Cpio.reset(*F);
-    else
-      errs() << "/linkrepro: failed to open " << Path
-             << ".cpio: " << F.getError().message() << '\n';
+    sys::path::append(Path, "repro.tar");
+
+    Expected<std::unique_ptr<TarWriter>> ErrOrWriter =
+        TarWriter::create(Path, "repro");
+
+    if (ErrOrWriter) {
+      Tar = std::move(*ErrOrWriter);
+    } else {
+      errs() << "/linkrepro: failed to open " << Path << ": "
+             << toString(ErrOrWriter.takeError()) << '\n';
+    }
   }
 
   if (Args.filtered_begin(OPT_INPUT) == Args.filtered_end())
@@ -683,10 +688,10 @@ void LinkerDriver::link(ArrayRef<const c
   if (!Resources.empty())
     addBuffer(convertResToCOFF(Resources));
 
-  if (Cpio)
-    Cpio->append("response.txt",
-                 createResponseFile(Args, FilePaths,
-                                    ArrayRef<StringRef>(SearchPaths).slice(1)));
+  if (Tar)
+    Tar->append("response.txt",
+                createResponseFile(Args, FilePaths,
+                                   ArrayRef<StringRef>(SearchPaths).slice(1)));
 
   // Handle /largeaddressaware
   if (Config->is64() || Args.hasArg(OPT_largeaddressaware))

Modified: lld/trunk/COFF/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.h?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.h (original)
+++ lld/trunk/COFF/Driver.h Thu Jan  5 20:33:53 2017
@@ -20,6 +20,7 @@
 #include "llvm/Object/COFF.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Support/TarWriter.h"
 #include <memory>
 #include <set>
 #include <vector>
@@ -74,7 +75,7 @@ private:
   ArgParser Parser;
   SymbolTable Symtab;
 
-  std::unique_ptr<CpioFile> Cpio; // for /linkrepro
+  std::unique_ptr<llvm::TarWriter> Tar; // for /linkrepro
 
   // Opens a file. Path has to be resolved already.
   MemoryBufferRef openFile(StringRef Path);

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Thu Jan  5 20:33:53 2017
@@ -25,6 +25,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cstdlib>
@@ -182,8 +183,8 @@ Optional<MemoryBufferRef> LinkerDriver::
   MemoryBufferRef MBRef = MB->getMemBufferRef();
   make<std::unique_ptr<MemoryBuffer>>(std::move(MB)); // take MB ownership
 
-  if (Cpio)
-    Cpio->append(relativeToRoot(Path), MBRef.getBuffer());
+  if (Tar)
+    Tar->append(relativeToRoot(Path), MBRef.getBuffer());
 
   return MBRef;
 }
@@ -309,14 +310,16 @@ void LinkerDriver::main(ArrayRef<const c
   if (const char *Path = getReproduceOption(Args)) {
     // Note that --reproduce is a debug option so you can ignore it
     // if you are trying to understand the whole picture of the code.
-    ErrorOr<CpioFile *> F = CpioFile::create(Path);
-    if (F) {
-      Cpio.reset(*F);
-      Cpio->append("response.txt", createResponseFile(Args));
-      Cpio->append("version.txt", getLLDVersion() + "\n");
-    } else
-      error(F.getError(),
-            Twine("--reproduce: failed to open ") + Path + ".cpio");
+    Expected<std::unique_ptr<TarWriter>> ErrOrWriter =
+        TarWriter::create(Path, path::stem(Path));
+    if (ErrOrWriter) {
+      Tar = std::move(*ErrOrWriter);
+      Tar->append("response.txt", createResponseFile(Args));
+      Tar->append("version.txt", getLLDVersion() + "\n");
+    } else {
+      error(Twine("--reproduce: failed to open ") + Path + ": " +
+            toString(ErrOrWriter.takeError()));
+    }
   }
 
   readConfigs(Args);

Modified: lld/trunk/ELF/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.h?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.h (original)
+++ lld/trunk/ELF/Driver.h Thu Jan  5 20:33:53 2017
@@ -17,6 +17,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Support/TarWriter.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace lld {
@@ -29,7 +30,7 @@ public:
   void main(ArrayRef<const char *> Args, bool CanExitEarly);
   void addFile(StringRef Path);
   void addLibrary(StringRef Name);
-  std::unique_ptr<CpioFile> Cpio; // for reproduce
+  std::unique_ptr<llvm::TarWriter> Tar; // for reproduce
 
 private:
   std::vector<MemoryBufferRef> getArchiveMembers(MemoryBufferRef MB);

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Thu Jan  5 20:33:53 2017
@@ -525,9 +525,9 @@ ArchiveFile::getMember(const Archive::Sy
             "could not get the buffer for the member defining symbol " +
                 Sym->getName());
 
-  if (C.getParent()->isThin() && Driver->Cpio)
-    Driver->Cpio->append(relativeToRoot(check(C.getFullName())),
-                         Ret.getBuffer());
+  if (C.getParent()->isThin() && Driver->Tar)
+    Driver->Tar->append(relativeToRoot(check(C.getFullName())),
+                        Ret.getBuffer());
   if (C.getParent()->isThin())
     return {Ret, 0};
   return {Ret, C.getChildOffset()};

Modified: lld/trunk/include/lld/Core/Reproduce.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Reproduce.h?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Reproduce.h (original)
+++ lld/trunk/include/lld/Core/Reproduce.h Thu Jan  5 20:33:53 2017
@@ -11,46 +11,15 @@
 #define LLD_CORE_REPRODUCE_H
 
 #include "lld/Core/LLVM.h"
-#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/StringSet.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
-
-class raw_fd_ostream;
-
 namespace opt { class Arg; }
-
 }
 
 namespace lld {
 
-// This class creates a .cpio file for --reproduce (ELF) or /linkrepro (COFF).
-//
-// If "--reproduce foo" is given, we create a file "foo.cpio" and
-// copy all input files to the archive, along with a response file
-// to re-run the same command with the same inputs.
-// It is useful for reporting issues to LLD developers.
-//
-// Cpio as a file format is a deliberate choice. It's standardized in
-// POSIX and very easy to create. cpio command is available virtually
-// on all Unix systems. See
-// http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_07
-// for the format details.
-class CpioFile {
-public:
-  static ErrorOr<CpioFile *> create(StringRef OutputPath);
-  void append(StringRef Path, StringRef Data);
-
-private:
-  CpioFile(std::unique_ptr<llvm::raw_fd_ostream> OS, StringRef Basename);
-
-  std::unique_ptr<llvm::raw_fd_ostream> OS;
-  llvm::StringSet<> Seen;
-  std::string Basename;
-};
-
 // Makes a given pathname an absolute path first, and then remove
 // beginning /. For example, "../foo.o" is converted to "home/john/foo.o",
 // assuming that the current directory is "/home/john/bar".

Modified: lld/trunk/lib/Core/Reproduce.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Reproduce.cpp?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/lib/Core/Reproduce.cpp (original)
+++ lld/trunk/lib/Core/Reproduce.cpp Thu Jan  5 20:33:53 2017
@@ -8,66 +8,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "lld/Core/Reproduce.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/Twine.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Format.h"
 #include "llvm/Support/Path.h"
 
 using namespace lld;
 using namespace llvm;
-using namespace sys;
-
-CpioFile::CpioFile(std::unique_ptr<raw_fd_ostream> OS, StringRef S)
-    : OS(std::move(OS)), Basename(S) {}
-
-ErrorOr<CpioFile *> CpioFile::create(StringRef OutputPath) {
-  std::string Path = (OutputPath + ".cpio").str();
-  std::error_code EC;
-  auto OS = llvm::make_unique<raw_fd_ostream>(Path, EC, sys::fs::F_None);
-  if (EC)
-    return EC;
-  return new CpioFile(std::move(OS), path::filename(OutputPath));
-}
-
-static void writeMember(raw_fd_ostream &OS, StringRef Path, StringRef Data) {
-  // The c_dev/c_ino pair should be unique according to the spec,
-  // but no one seems to care.
-  OS << "070707";                        // c_magic
-  OS << "000000";                        // c_dev
-  OS << "000000";                        // c_ino
-  OS << "100664";                        // c_mode: C_ISREG | rw-rw-r--
-  OS << "000000";                        // c_uid
-  OS << "000000";                        // c_gid
-  OS << "000001";                        // c_nlink
-  OS << "000000";                        // c_rdev
-  OS << "00000000000";                   // c_mtime
-  OS << format("%06o", Path.size() + 1); // c_namesize
-  OS << format("%011o", Data.size());    // c_filesize
-  OS << Path << '\0';                    // c_name
-  OS << Data;                            // c_filedata
-}
-
-void CpioFile::append(StringRef Path, StringRef Data) {
-  if (!Seen.insert(Path).second)
-    return;
-
-  // Construct an in-archive filename so that /home/foo/bar is stored
-  // as baz/home/foo/bar where baz is the basename of the output file.
-  // (i.e. in that case we are creating baz.cpio.)
-  SmallString<128> Fullpath;
-  path::append(Fullpath, Basename, Path);
-
-  writeMember(*OS, convertToUnixPathSeparator(Fullpath), Data);
-
-  // Print the trailer and seek back.
-  // This way we have a valid archive if we crash.
-  uint64_t Pos = OS->tell();
-  writeMember(*OS, "TRAILER!!!", "");
-  OS->seek(Pos);
-}
+using namespace llvm::sys;
 
 // Makes a given pathname an absolute path first, and then remove
 // beginning /. For example, "../foo.o" is converted to "home/john/foo.o",
@@ -76,7 +24,7 @@ void CpioFile::append(StringRef Path, St
 // a mess with backslash-as-escape and backslash-as-path-separator.
 std::string lld::relativeToRoot(StringRef Path) {
   SmallString<128> Abs = Path;
-  if (sys::fs::make_absolute(Abs))
+  if (fs::make_absolute(Abs))
     return Path;
   path::remove_dots(Abs, /*remove_dot_dot=*/true);
 

Modified: lld/trunk/test/COFF/linkrepro.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/linkrepro.test?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/test/COFF/linkrepro.test (original)
+++ lld/trunk/test/COFF/linkrepro.test Thu Jan  5 20:33:53 2017
@@ -1,6 +1,3 @@
-# cpio fails on windows with "Function not implemented".
-# REQUIRES: shell
-
 # RUN: rm -rf %t.dir
 # RUN: mkdir -p %t.dir/build1 %t.dir/build2 %t.dir/build3
 # RUN: yaml2obj < %p/Inputs/hello32.yaml > %t.obj
@@ -8,7 +5,7 @@
 # RUN: cd %t.dir/build1
 # RUN: lld-link %t.obj %p/Inputs/std32.lib /subsystem:console \
 # RUN:   /entry:main at 0 /linkrepro:. /out:%t.exe
-# RUN: cpio -id < repro.cpio
+# RUN: tar xf repro.tar
 # RUN: diff %t.obj repro/%:t.obj
 # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib
 # RUN: FileCheck %s --check-prefix=RSP < repro/response.txt
@@ -16,7 +13,7 @@
 # RUN: cd %t.dir/build2
 # RUN: lld-link %t.obj /libpath:%p/Inputs /defaultlib:std32 /subsystem:console \
 # RUN:   /entry:main at 0 /linkrepro:. /out:%t.exe
-# RUN: cpio -id < repro.cpio
+# RUN: tar xf repro.tar
 # RUN: diff %t.obj repro/%:t.obj
 # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib
 # RUN: FileCheck %s --check-prefix=RSP < repro/response.txt
@@ -24,7 +21,7 @@
 # RUN: cd %t.dir/build3
 # RUN: env LIB=%p/Inputs lld-link %t.obj /defaultlib:std32 /subsystem:console \
 # RUN:   /entry:main at 0 /linkrepro:. /out:%t.exe
-# RUN: cpio -id < repro.cpio
+# RUN: tar xf repro.tar
 # RUN: diff %t.obj repro/%:t.obj
 # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib
 # RUN: FileCheck %s --check-prefix=RSP < repro/response.txt

Modified: lld/trunk/test/ELF/reproduce-backslash.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce-backslash.s?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce-backslash.s (original)
+++ lld/trunk/test/ELF/reproduce-backslash.s Thu Jan  5 20:33:53 2017
@@ -1,9 +1,9 @@
-# REQUIRES: x86, cpio, shell
+# REQUIRES: x86, shell
 
 # Test that we don't erroneously replace \ with / on UNIX, as it's
 # legal for a filename to contain backslashes.
 # RUN: llvm-mc %s -o foo\\.o -filetype=obj -triple=x86_64-pc-linux
 # RUN: ld.lld foo\\.o --reproduce repro
-# RUN: cpio -it < repro.cpio | FileCheck %s
+# RUN: tar tf repro.tar | FileCheck %s
 
-# CHECK: repro/{{.*}}/foo\.o
+# CHECK: repro/{{.*}}/foo\\.o

Modified: lld/trunk/test/ELF/reproduce-error.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce-error.s?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce-error.s (original)
+++ lld/trunk/test/ELF/reproduce-error.s Thu Jan  5 20:33:53 2017
@@ -1,15 +1,14 @@
-# Extracting the cpio archive can get over the path limit on windows.
+# Extracting the tar archive can get over the path limit on windows.
 # REQUIRES: shell
 
 # RUN: rm -rf %t.dir
 # RUN: mkdir -p %t.dir
 # RUN: cd %t.dir
 
-# RUN: not ld.lld --reproduce repro abc -o t 2>&1 | FileCheck %s
+# RUN: not ld.lld --reproduce repro.tar abc -o t 2>&1 | FileCheck %s
 # CHECK: cannot open abc: {{N|n}}o such file or directory
 
-# RUN: grep TRAILER repro.cpio
-# RUN: cpio -id < repro.cpio
+# RUN: tar xf repro.tar
 # RUN: FileCheck --check-prefix=RSP %s < repro/response.txt
 # RSP: abc
 # RSP: -o t

Modified: lld/trunk/test/ELF/reproduce-linkerscript.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce-linkerscript.s?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce-linkerscript.s (original)
+++ lld/trunk/test/ELF/reproduce-linkerscript.s Thu Jan  5 20:33:53 2017
@@ -5,8 +5,8 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build/foo.o
 # RUN: echo "INPUT(\"%t.dir/build/foo.o\")" > %t.dir/build/foo.script
 # RUN: cd %t.dir
-# RUN: ld.lld build/foo.script -o bar --reproduce repro
-# RUN: cpio -id < repro.cpio
+# RUN: ld.lld build/foo.script -o bar --reproduce repro.tar
+# RUN: tar xf repro.tar
 # RUN: diff build/foo.script repro/%:t.dir/build/foo.script
 # RUN: diff build/foo.o repro/%:t.dir/build/foo.o
 

Modified: lld/trunk/test/ELF/reproduce-thin-archive.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce-thin-archive.s?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce-thin-archive.s (original)
+++ lld/trunk/test/ELF/reproduce-thin-archive.s Thu Jan  5 20:33:53 2017
@@ -5,8 +5,8 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.dir/foo.o
 # RUN: cd %t.dir
 # RUN: llvm-ar --format=gnu rcT foo.a foo.o
-# RUN: ld.lld -m elf_x86_64 foo.a -o bar --reproduce repro
-# RUN: cpio -id < repro.cpio
+# RUN: ld.lld -m elf_x86_64 foo.a -o bar --reproduce repro.tar
+# RUN: tar xf repro.tar
 # RUN: diff foo.a repro/%:t.dir/foo.a
 # RUN: diff foo.o repro/%:t.dir/foo.o
 

Modified: lld/trunk/test/ELF/reproduce-windows.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce-windows.s?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce-windows.s (original)
+++ lld/trunk/test/ELF/reproduce-windows.s Thu Jan  5 20:33:53 2017
@@ -1,12 +1,12 @@
-# REQUIRES: x86, cpio
+# REQUIRES: x86
 
 # Test that a repro archive always uses / instead of \.
 # RUN: rm -rf %t.dir
 # RUN: mkdir -p %t.dir/build
 # RUN: llvm-mc %s -o %t.dir/build/foo.o -filetype=obj -triple=x86_64-pc-linux
 # RUN: cd %t.dir
-# RUN: ld.lld build/foo.o --reproduce repro
-# RUN: cpio -it < repro.cpio | FileCheck %s
+# RUN: ld.lld build/foo.o --reproduce repro.tar
+# RUN: tar tf repro.tar | FileCheck %s
 
 # CHECK: repro/response.txt
 # CHECK: repro/{{.*}}/build/foo.o

Modified: lld/trunk/test/ELF/reproduce-windows2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce-windows2.s?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce-windows2.s (original)
+++ lld/trunk/test/ELF/reproduce-windows2.s Thu Jan  5 20:33:53 2017
@@ -1,4 +1,4 @@
-# REQUIRES: system-windows, x86, cpio
+# REQUIRES: system-windows, x86
 
 # Test that a response.txt file always uses / instead of \.
 # RUN: rm -rf %t.dir
@@ -6,6 +6,5 @@
 # RUN: llvm-mc %s -o %t.dir/build/foo.o -filetype=obj -triple=x86_64-pc-linux
 # RUN: cd %t.dir
 # RUN: ld.lld build/foo.o --reproduce repro
-# RUN: echo "*response.txt" > list.txt
-# RUN: cpio -i --to-stdout --pattern-file=list.txt < repro.cpio | FileCheck %s
+# RUN: tar -O -x -f repro.tar repro/response.txt | FileCheck %s
 # CHECK: {{.*}}/build/foo.o

Modified: lld/trunk/test/ELF/reproduce.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce.s?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce.s (original)
+++ lld/trunk/test/ELF/reproduce.s Thu Jan  5 20:33:53 2017
@@ -1,14 +1,14 @@
-# REQUIRES: x86, cpio
+# REQUIRES: x86
 
-# Extracting the cpio archive can get over the path limit on windows.
+# Extracting the tar archive can get over the path limit on windows.
 # REQUIRES: shell
 
 # RUN: rm -rf %t.dir
 # RUN: mkdir -p %t.dir/build1
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build1/foo.o
 # RUN: cd %t.dir
-# RUN: ld.lld --hash-style=gnu build1/foo.o -o bar -shared --as-needed --reproduce repro
-# RUN: cpio -id < repro.cpio
+# RUN: ld.lld --hash-style=gnu build1/foo.o -o bar -shared --as-needed --reproduce repro.tar
+# RUN: tar xf repro.tar
 # RUN: diff build1/foo.o repro/%:t.dir/build1/foo.o
 
 # RUN: FileCheck %s --check-prefix=RSP < repro/response.txt
@@ -25,8 +25,8 @@
 # RUN: mkdir -p %t.dir/build2/a/b/c
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build2/foo.o
 # RUN: cd %t.dir/build2/a/b/c
-# RUN: env LLD_REPRODUCE=repro ld.lld ./../../../foo.o -o bar -shared --as-needed
-# RUN: cpio -id < repro.cpio
+# RUN: env LLD_REPRODUCE=repro.tar ld.lld ./../../../foo.o -o bar -shared --as-needed
+# RUN: tar xf repro.tar
 # RUN: diff %t.dir/build2/foo.o repro/%:t.dir/build2/foo.o
 
 # RUN: echo "{ local: *; };" >  ver
@@ -34,10 +34,10 @@
 # RUN: echo > file
 # RUN: echo > file2
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o 'foo bar'
-# RUN: ld.lld --reproduce repro2 'foo bar' -L"foo bar" -Lfile -Tfile2 \
+# RUN: ld.lld --reproduce repro2.tar 'foo bar' -L"foo bar" -Lfile -Tfile2 \
 # RUN:   --dynamic-list dyn -rpath file --script=file --version-script ver \
 # RUN:   --dynamic-linker "some unusual/path" -soname 'foo bar' -soname='foo bar'
-# RUN: cpio -id < repro2.cpio
+# RUN: tar xf repro2.tar
 # RUN: FileCheck %s --check-prefix=RSP2 < repro2/response.txt
 # RSP2:      "{{.*}}foo bar"
 # RSP2-NEXT: -L "{{.*}}foo bar"
@@ -51,7 +51,7 @@
 # RSP2-NEXT: -soname="foo bar"
 # RSP2-NEXT: -soname="foo bar"
 
-# RUN: cpio -it < repro2.cpio | FileCheck %s
+# RUN: tar tf repro2.tar | FileCheck %s
 # CHECK:      repro2/response.txt
 # CHECK-NEXT: repro2/version.txt
 # CHECK-NEXT: repro2/{{.*}}/dyn

Modified: lld/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/lit.cfg?rev=291210&r1=291209&r2=291210&view=diff
==============================================================================
--- lld/trunk/test/lit.cfg (original)
+++ lld/trunk/test/lit.cfg Thu Jan  5 20:33:53 2017
@@ -258,7 +258,3 @@ cvtres = lit.util.which('cvtres', config
 rc = lit.util.which('rc', config.environment['PATH'])
 if cvtres and rc:
     config.available_features.add('winres')
-
-# Check if "cpio" command exists.
-if lit.util.which('cpio', config.environment['PATH']):
-    config.available_features.add('cpio')




More information about the llvm-commits mailing list