Make test/ELF/reproduces.s test to work on Windows.
authorRui Ueyama <ruiu@google.com>
Tue, 26 Apr 2016 19:04:35 +0000 (19:04 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 26 Apr 2016 19:04:35 +0000 (19:04 +0000)
Previously, the test didn't work on Windows because it tried to
concatenate two (possibly) absolute paths. If two paths are absolute
paths that have drive letters, then the result would become something
like C:\foo\D:\bar. That's not a valid path. I changed the test to
use relative paths.

llvm-svn: 267588

lld/test/ELF/reproduce.s

index 1d448fd..cd27932 100644 (file)
@@ -1,26 +1,21 @@
-# REQUIRES: x86, shell
+# REQUIRES: x86
 
-# RUN: rm -rf %t.dir/repro
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: ld.lld %t -o %t2 -shared --as-needed --reproduce %t.dir/repro
-# RUN: llvm-objdump -d %t.dir/repro/%t | FileCheck %s --check-prefix=DUMP
-# RUN: cat %t.dir/repro/invocation.txt | FileCheck %s --check-prefix=INVOCATION
+# RUN: rm -rf %t.dir1
+# RUN: mkdir -p %t.dir1/build
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir1/build/foo.o
+# RUN: cd %t.dir1
+# RUN: ld.lld build/foo.o -o bar -shared --as-needed --reproduce repro
+# RUN: diff build/foo.o repro/build/foo.o
 
-.globl _start;
+.globl _start
 _start:
   mov $60, %rax
   mov $42, %rdi
   syscall
 
-# DUMP: Disassembly of section .text:
-# DUMP: _start:
-# DUMP:        0:       48 c7 c0 3c 00 00 00    movq    $60, %rax
-# DUMP:        7:       48 c7 c7 2a 00 00 00    movq    $42, %rdi
-# DUMP:        e:       0f 05   syscall
+# RUN: FileCheck %s --check-prefix=INVOCATION < repro/invocation.txt
+# INVOCATION: lld{{[^\s]*}} build/foo.o -o bar -shared --as-needed --reproduce repro
 
-# INVOCATION: lld {{.*}}reproduce.s{{.*}} -o {{.*}} -shared --as-needed --reproduce
-
-# RUN: rm -rf %t.dir/repro2
-# RUN: mkdir %t.dir/repro2
-# RUN: not ld.lld %t -o %t2 --reproduce %t.dir/repro2 2>&1 | FileCheck --check-prefix=EDIR %s
-# EDIR: --reproduce: can't create directory
+# RUN: not ld.lld build/foo.o -o bar -shared --as-needed --reproduce repro 2>&1 \
+# RUN:   | FileCheck --check-prefix=ERROR %s
+# ERROR: --reproduce: can't create directory