[lld-macho] Move all tests for erroneous inputs under invalid/
authorJez Ng <jezng@fb.com>
Tue, 19 May 2020 14:57:14 +0000 (07:57 -0700)
committerJez Ng <jezng@fb.com>
Tue, 2 Jun 2020 20:19:38 +0000 (13:19 -0700)
For consistency.

The no-id-dylib test was originally referencing the Inputs/ folder via a
relative path. Instead of updating that path, I decided to make the test
self-contained.

Reviewed By: MaskRay

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

lld/test/MachO/invalid/alignment-too-large.yaml [moved from lld/test/MachO/alignment-too-large.yaml with 100% similarity]
lld/test/MachO/invalid/duplicate-symbol.s [moved from lld/test/MachO/duplicate-symbol.s with 100% similarity]
lld/test/MachO/invalid/invalid-executable.s [moved from lld/test/MachO/invalid-executable.s with 100% similarity]
lld/test/MachO/invalid/invalid-fat-narch.s [moved from lld/test/MachO/invalid-fat-narch.s with 100% similarity]
lld/test/MachO/invalid/invalid-fat-offset.s [moved from lld/test/MachO/invalid-fat-offset.s with 100% similarity]
lld/test/MachO/invalid/missing-dylib.s [moved from lld/test/MachO/missing-dylib.s with 100% similarity]
lld/test/MachO/invalid/no-id-dylink.yaml [moved from lld/test/MachO/Inputs/no-id-dylib.yaml with 87% similarity]
lld/test/MachO/invalid/no-such-file.s [moved from lld/test/MachO/no-such-file.s with 100% similarity]
lld/test/MachO/no-id-dylink.s [deleted file]

similarity index 87%
rename from lld/test/MachO/Inputs/no-id-dylib.yaml
rename to lld/test/MachO/invalid/no-id-dylink.yaml
index 86657da..d5b0b33 100644 (file)
@@ -1,5 +1,12 @@
-## This yaml file was originally generated from linking the following source
-## input with ld64:
+# REQUIRES: x86
+# RUN: mkdir -p %t
+# RUN: yaml2obj %s -o %t/libnoid.dylib
+# RUN: echo ".globl _main; .text; _main: ret" | llvm-mc -filetype=obj -triple=x86_64-apple-darwin -o %t/no-id-dylink.o
+# RUN: not lld -flavor darwinnew -o %t/no-id-dylink -Z -L%t -lnoid %t/no-id-dylink.o 2>&1 | FileCheck %s
+# CHECK: error: dylib {{.*}}libnoid.dylib missing LC_ID_DYLIB load command
+
+## This YAML file was originally generated from linking the following source
+## input with ld64 and passing the resulting binary through obj2yaml:
 ##
 ## .section __TEXT,__cstring
 ## .globl _hello_world
@@ -7,9 +14,9 @@
 ## _hello_world:
 ## .asciz "Hello world!\n"
 ##
-## Then we deleted the LC_ID_DYLIB command from the YAML file.
+## Then we deleted the LC_ID_DYLIB command from the file.
 
---- !mach-o
+!mach-o
 FileHeader:
   magic:           0xFEEDFACF
   cputype:         0x01000007
@@ -157,4 +164,3 @@ LinkEditData:
     - ' '
     - _hello_world
     - ''
-...
diff --git a/lld/test/MachO/no-id-dylink.s b/lld/test/MachO/no-id-dylink.s
deleted file mode 100644 (file)
index 7353b40..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# REQUIRES: x86
-# RUN: mkdir -p %t
-# RUN: yaml2obj %p/Inputs/no-id-dylib.yaml -o %t/libnoid.dylib
-# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/no-id-dylink.o
-# RUN: not lld -flavor darwinnew -o %t/no-id-dylink -Z -L%t -lnoid %t/no-id-dylink.o 2>&1 | FileCheck %s
-# CHECK: error: dylib {{.*}}libnoid.dylib missing LC_ID_DYLIB load command
-
-.text
-.globl _main
-
-_main:
-  mov $0, %rax
-  ret