xref: /llvm-project/clang/test/InstallAPI/invalid-exclusive-passes.test (revision c9dc52d424b7a264d4bcb29d7f56551304396d7f)
1; RUN: rm -rf %t
2; RUN: split-file %s %t
3
4// Validate arguments not allowed with -X
5; RUN: not clang-installapi \
6; RUN: -target arm64-apple-macos12 \
7; RUN: -install_name @rpath/libfoo.dylib \
8; RUN: -current_version 1 -compatibility_version 1 \
9; RUN: -XApple -I/fake/path -I%t %t/inputs.json \
10; RUN: -dynamiclib -o %t/output.tbd  2>&1 | FileCheck %s --check-prefix=INVALID_OPT
11; INVALID_OPT: error: invalid argument '-XApple' not allowed with '-I/fake/path'
12
13// Validate reserved labels.
14; RUN: not clang-installapi \
15; RUN: -target arm64-apple-macos12 \
16; RUN: -install_name @rpath/libfoo.dylib \
17; RUN: -current_version 1 -compatibility_version 1 \
18; RUN: -XApple -DDarwin=1 -XElf -DNONDarwin=1 \
19; RUN: -I%t -dynamiclib -o %t/output.tbd %t/inputs.json \
20; RUN: -XPrivate -DInvalid=1 2>&1 | FileCheck %s --check-prefix=INVALID_LABELS
21; INVALID_LABELS: error: label 'Private' is reserved: use a different label name for -X<label>
22
23// Validate arguments not allowed with -Xproject
24; RUN: not clang-installapi \
25; RUN: -target arm64-apple-macos12 \
26; RUN: -install_name @rpath/libfoo.dylib \
27; RUN: -current_version 1 -compatibility_version 1 \
28; RUN: -Xproject -fprofile-instr-generate \
29; RUN: %t/inputs.json -I%t -dynamiclib \
30; RUN: -o %t/output.tbd 2>&1 | FileCheck %s --check-prefix=INVALID_PROJECT_OPT
31; INVALID_PROJECT_OPT: error: invalid argument '-Xproject' not allowed with '-fprofile-instr-generate'
32
33// Validate arguments not allowed with -X passed via json
34; RUN: not clang-installapi -target arm64-apple-macos12 \
35; RUN: -install_name @rpath/libfoo.dylib -current_version 1 -compatibility_version 1 \
36; RUN: -optionlist %t/options.json -I/fake/path \
37; RUN: -I%t -dynamiclib -o %t/output.tbd 2>&1 | FileCheck %s --check-prefix=INVALID_JSON_OPT
38; INVALID_JSON_OPT: error: invalid argument '-XApple' not allowed with '-I/fake/path'
39
40// Validate invalid json path
41; RUN: not clang-installapi -target arm64-apple-macos12 \
42; RUN: -install_name @rpath/libfoo.dylib -current_version 1 \
43; RUN: -compatibility_version 1 -optionlist %t/invalid_loc.json \
44; RUN: -I/fake/path -I%t -dynamiclib \
45; RUN: -o %t/output.tbd %t 2>&1 | FileCheck %s --check-prefix=INVALID_JSON_LOC -DMSG=%errc_ENOENT
46; INVALID_JSON_LOC: error: cannot open file {{.*}}invalid_loc.json': [[MSG]]
47
48// Validate invalid json format
49; RUN: not clang-installapi -target arm64-apple-macos12 \
50; RUN: -install_name @rpath/libfoo.dylib -current_version 1 \
51; RUN: -compatibility_version 1 -optionlist %t/invalid_format.json \
52; RUN: -I/fake/path -isysroot %sysroot -I%t -dynamiclib \
53; RUN: -o %t/output.tbd %t 2>&1 | FileCheck %s --check-prefix=INVALID_JSON_FORMAT
54; INVALID_JSON_FORMAT: error: could not read option input list {{.*}}invalid_format.json': invalid input format
55
56;--- options.json
57{
58  "Apple" : ["-I/fake/path"]
59}
60
61;--- invalid_format.json
62{
63  "Apple" : {"opt"  : "-I/fake/path"}
64}
65
66;--- inputs.json
67{
68  "headers": [ ],
69  "version": "3"
70}
71