Skip to content
Snippets Groups Projects
Commit 6bb836af authored by Gulfem Savrun Yeniceri's avatar Gulfem Savrun Yeniceri
Browse files

Revert "[clang][deps] NFC: De-duplicate clang-cl tests"

This reverts commit 30cb49b4.
It caused test failures on Fuchsia Toolchain Mac builds:
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-mac-x64/b8818888168677577537/overview
parent 33b214b7
No related branches found
No related tags found
No related merge requests found
Showing
with 155 additions and 142 deletions
......@@ -3,5 +3,10 @@
"directory": "DIR",
"command": "clang -E DIR/has_include_if_elif2.cpp -IInputs",
"file": "DIR/has_include_if_elif2.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /IInputs -- DIR/has_include_if_elif2_clangcl.cpp",
"file": "DIR/has_include_if_elif2_clangcl.cpp"
}
]
......@@ -3,5 +3,10 @@
"directory": "DIR",
"command": "clang -E DIR/header_stat_before_open_input.m -iframework Inputs/frameworks",
"file": "DIR/header_stat_before_open_input.m"
},
{
"directory": "DIR",
"command": "clang-cl /E -Xclang -iframework -Xclang Inputs/frameworks -- DIR/header_stat_before_open_input_clangcl.m",
"file": "DIR/header_stat_before_open_input_clangcl.m"
}
]
......@@ -3,5 +3,10 @@
"directory": "DIR",
"command": "clang -c -IDIR -IDIR/foodir -IInputs DIR/headerwithdirname_input.cpp",
"file": "DIR/headerwithdirname_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /c /IDIR /IDIR/foodir -IInputs -- DIR/headerwithdirname_input_clangcl.cpp",
"file": "DIR/headerwithdirname_input_clangcl.cpp"
}
]
......@@ -3,5 +3,10 @@
"directory": "DIR",
"command": "clang -c -IDIR -IInputs DIR/headerwithdirname_input.cpp",
"file": "DIR/headerwithdirname_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /c /IDIR /IInputs -- DIR/headerwithdirname_input_clangcl.cpp",
"file": "DIR/headerwithdirname_input_clangcl.cpp"
}
]
[
{
"directory": "DIR",
"command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -- DIR/modules_cdb_input2.cpp",
"file": "DIR/modules_cdb_input2.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -- DIR/modules_cdb_input.cpp",
"file": "DIR/modules_cdb_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -o a.o -- DIR/modules_cdb_input.cpp",
"file": "DIR/modules_cdb_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -o b.o -- DIR/modules_cdb_input.cpp",
"file": "DIR/modules_cdb_input.cpp"
}
]
[
{
"directory": "DIR",
"command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
"file": ""
},
{
"directory": "DIR",
"command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
"file": ""
},
]
......@@ -3,5 +3,10 @@
"directory": "DIR",
"command": "clang -E DIR/no-werror_input.cpp -IInputs -std=c++17 -Weverything -Werror",
"file": "DIR/no-werror.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /IInputs /std:c++17 -Weverything -Werror -- DIR/no-werror_input_clangcl.cpp",
"file": "DIR/no-werror_clangcl.cpp"
}
]
[
{
"directory": "DIR",
"command": "clang --driver-mode=cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/regular_cdb2_clangcl.d -- DIR/regular_cdb_input2.cpp",
"file": "DIR/regular_cdb_input2.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /IInputs -- DIR/regular_cdb_input.cpp",
"file": "DIR/regular_cdb_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /IInputs /Foadena.o -- DIR/regular_cdb_input.cpp",
"file": "DIR/regular_cdb_input.cpp"
}
]
......@@ -3,5 +3,10 @@
"directory": "DIR",
"command": "clang --analyze DIR/static-analyzer_clang.c",
"file": "DIR/static-analyzer_clang.c"
},
{
"directory": "DIR",
"command": "clang-cl --analyze -- DIR/static-analyzer_clangcl.c",
"file": "DIR/static-analyzer_clangcl.c"
}
]
......@@ -23,5 +23,45 @@
"directory": "DIR",
"command": "clang-cl /E -- DIR/target-filename_input.cpp",
"file": "DIR/target-filename_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E -o clangcl-a.o -- DIR/target-filename_input.cpp",
"file": "DIR/target-filename_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E -oclangcl-b.o -- DIR/target-filename_input.cpp",
"file": "DIR/target-filename_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /o clangcl-c.o -- DIR/target-filename_input.cpp",
"file": "DIR/target-filename_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /oclangcl-d.o -- DIR/target-filename_input.cpp",
"file": "DIR/target-filename_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /Foclangcl-e.o -- DIR/target-filename_input.cpp",
"file": "DIR/target-filename_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E -o clangcl-firstf.o -o clangcl-lastf.o -- DIR/target-filename_input.cpp",
"file": "DIR/target-filename_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /oclangcl-firstg.o /Foclangcl-lastg.o -- DIR/target-filename_input.cpp",
"file": "DIR/target-filename_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /Foclangcl-firsth.o -o clangcl-midh.o /oclangcl-lasth.o -- DIR/target-filename_input.cpp",
"file": "DIR/target-filename_input.cpp"
}
]
......@@ -4,4 +4,9 @@
"command": "clang -E DIR/vfsoverlay_input.cpp -IInputs -ivfsoverlay DIR/vfsoverlay.yaml",
"file": "DIR/vfsoverlay_input.cpp"
},
{
"directory": "DIR",
"command": "clang-cl /E /IInputs -Xclang -ivfsoverlay -Xclang DIR/vfsoverlay.yaml -- DIR/vfsoverlay_input_clangcl.cpp",
"file": "DIR/vfsoverlay_input_clangcl.cpp"
}
]
// This test checks that the output path is correctly deduced/recognized in clang-cl mode.
// RUN: rm -rf %t
// RUN: split-file %s %t
//--- deduce-cdb.json.template
[{
"file": "DIR/test.c",
"directory": "DIR",
"command": "clang --driver-mode=cl /c -- DIR/test.c"
},{
"file": "DIR/test.c",
"directory": "DIR",
"command": "clang-cl /c -- DIR/test.c"
}]
//--- recognize-cdb.json.template
[{
"file": "DIR/test.c",
"directory": "DIR",
"command": "clang-cl /c -o DIR/test.o -- DIR/test.c"
},{
"file": "DIR/test.c",
"directory": "DIR",
"command": "clang-cl /c /o DIR/test.o -- DIR/test.c"
},{
"file": "DIR/test.c",
"directory": "DIR",
"command": "clang-cl /c -oDIR/test.o -- DIR/test.c"
},{
"file": "DIR/test.c",
"directory": "DIR",
"command": "clang-cl /c /oDIR/test.o -- DIR/test.c"
},{
"file": "DIR/test.c",
"directory": "DIR",
"command": "clang-cl /c -FoDIR/test.o -- DIR/test.c"
},{
"file": "DIR/test.c",
"directory": "DIR",
"command": "clang-cl /c /FoDIR/test.o -- DIR/test.c"
}]
//--- last-arg-cdb.json.template
[{
"file": "DIR/test.c",
"directory": "DIR",
"command": "clang-cl /c -o DIR/test.o -o DIR/last.o -- DIR/test.c"
}]
//--- test.c
// Check that missing output path is deduced (with both clang-cl executable and driver mode flag):
//
// RUN: sed -e "s|DIR|%/t|g" %t/deduce-cdb.json.template > %t/deduce-cdb.json
// RUN: clang-scan-deps -compilation-database %t/deduce-cdb.json -j 1 > %t/deduce-result.d
// RUN: cat %t/deduce-result.d | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefix=CHECK-DEDUCE
// CHECK-DEDUCE: test.obj:
// CHECK-DEDUCE-NEXT: [[PREFIX]]/test.c
// CHECK-DEDUCE-NEXT: test.obj:
// CHECK-DEDUCE-NEXT: [[PREFIX]]/test.c
// Check that all the different ways to specify output file are recognized:
//
// RUN: sed -e "s|DIR|%/t|g" %t/recognize-cdb.json.template > %t/recognize-cdb.json
// RUN: clang-scan-deps -compilation-database %t/recognize-cdb.json -j 1 > %t/recognize-result.d
// RUN: cat %t/recognize-result.d | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefix=CHECK-RECOGNIZE
// CHECK-RECOGNIZE: [[PREFIX]]/test.o:
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.o:
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.o:
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.o:
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.o:
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.o:
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
// Check that the last argument specifying the output path wins.
//
// RUN: sed -e "s|DIR|%/t|g" %t/last-arg-cdb.json.template > %t/last-arg-cdb.json
// RUN: clang-scan-deps -compilation-database %t/last-arg-cdb.json > %t/last-arg-result.d
// RUN: cat %t/last-arg-result.d | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefix=CHECK-LAST
// CHECK-LAST: [[PREFIX]]/last.o:
// CHECK-LAST-NEXT: [[PREFIX]]/test.c
// This test checks that the clang-cl compiler is correctly invoked to deduce resource directory.
// REQUIRES: shell
// RUN: rm -rf %t
// RUN: split-file %s %t
//--- cdb.json.template
[{
"file": "DIR/test.c",
"directory": "DIR",
"command": "DIR/clang-cl /c /o DIR/test.o -- DIR/test.c"
}]
//--- clang-cl
#!/bin/sh
# This is a fake compiler that should be invoked the clang-cl way to print the resource directory.
if [ "$1" = "/clang:-print-resource-dir" ]; then
echo "/pass"
else
echo "/fail"
fi;
//--- test.c
// RUN: chmod +x %t/clang-cl
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
// RUN: clang-scan-deps -compilation-database %t/cdb.json --resource-dir-recipe invoke-compiler \
// RUN: --format experimental-full > %t/result.json
// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s
// CHECK: "-resource-dir"
// CHECK-NEXT: "/pass"
// This test checks that '-Xclang' arguments are ignored during the clang-cl command line adjustment.
// This prevents interpreting '-Xclang -I -Xclang /opt/include' as '/o pt/include' (output path).
// RUN: rm -rf %t
// RUN: split-file %s %t
//--- cdb.json.template
[{
"file": "DIR/test.c",
"directory": "DIR",
"command": "clang-cl /c /o DIR/test.o -Xclang -I -Xclang /opt/include -- DIR/test.c"
}]
//--- test.c
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
// RUN: clang-scan-deps -compilation-database %t/cdb.json > %t/result.d
// RUN: cat %t/result.d | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
// CHECK: [[PREFIX]]/test.o:
// CHECK-NEXT: [[PREFIX]]/test.c
......@@ -3,11 +3,16 @@
// RUN: mkdir -p %t.dir
// RUN: cp %s %t.dir/regular_cdb_input.cpp
// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb.json > %t.cdb
// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb_clangcl.json > %t_clangcl.cdb
//
// RUN: not clang-scan-deps -compilation-database %t.cdb -j 1 2>%t.dir/errs
// RUN: echo EOF >> %t.dir/errs
// RUN: FileCheck %s --input-file %t.dir/errs
// RUN: not clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 2>%t.dir/errs_clangcl
// RUN: echo EOF >> %t.dir/errs_clangcl
// RUN: FileCheck %s --input-file %t.dir/errs_clangcl
#include "missing.h"
// CHECK: Error while scanning dependencies
......
......@@ -2,6 +2,7 @@
// RUN: rm -rf %t.cdb
// RUN: mkdir -p %t.dir
// RUN: cp %s %t.dir/has_include_if_elif2.cpp
// RUN: cp %s %t.dir/has_include_if_elif2_clangcl.cpp
// RUN: mkdir %t.dir/Inputs
// RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h
// RUN: cp %S/Inputs/header.h %t.dir/Inputs/header2.h
......@@ -36,3 +37,9 @@
// CHECK-NEXT: Inputs{{/|\\}}header2.h
// CHECK-NEXT: Inputs{{/|\\}}header3.h
// CHECK-NEXT: Inputs{{/|\\}}header4.h
// CHECK: has_include_if_elif2_clangcl.cpp
// CHECK-NEXT: Inputs{{/|\\}}header.h
// CHECK-NEXT: Inputs{{/|\\}}header2.h
// CHECK-NEXT: Inputs{{/|\\}}header3.h
// CHECK-NEXT: Inputs{{/|\\}}header4.h
......@@ -2,6 +2,7 @@
// RUN: rm -rf %t.cdb
// RUN: mkdir -p %t.dir
// RUN: cp %s %t.dir/header_stat_before_open_input.m
// RUN: cp %s %t.dir/header_stat_before_open_input_clangcl.m
// RUN: mkdir %t.dir/Inputs
// RUN: cp -R %S/Inputs/frameworks %t.dir/Inputs/frameworks
// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/header_stat_before_open_cdb.json > %t.cdb
......@@ -16,3 +17,8 @@
// CHECK-NEXT: header_stat_before_open_input.m
// CHECK-NEXT: Inputs{{/|\\}}frameworks{{/|\\}}Framework.framework{{/|\\}}Headers{{/|\\}}Framework.h
// CHECK-NEXT: Inputs{{/|\\}}frameworks{{/|\\}}Framework.framework{{/|\\}}PrivateHeaders{{/|\\}}PrivateHeader.h
// CHECK: header_stat_before_open_input_clangcl.o
// CHECK-NEXT: header_stat_before_open_input_clangcl.m
// CHECK-NEXT: Inputs{{/|\\}}frameworks{{/|\\}}Framework.framework{{/|\\}}Headers{{/|\\}}Framework.h
// CHECK-NEXT: Inputs{{/|\\}}frameworks{{/|\\}}Framework.framework{{/|\\}}PrivateHeaders{{/|\\}}PrivateHeader.h
......@@ -4,6 +4,7 @@
// RUN: mkdir -p %t.dir
// RUN: mkdir -p %t.dir/foodir
// RUN: cp %s %t.dir/headerwithdirname_input.cpp
// RUN: cp %s %t.dir/headerwithdirname_input_clangcl.cpp
// RUN: mkdir %t.dir/Inputs
// RUN: cp %S/Inputs/foodir %t.dir/Inputs/foodir
// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/headerwithdirname.json > %t.cdb
......@@ -15,3 +16,7 @@
// CHECK: headerwithdirname_input{{\.o|.*\.s}}
// CHECK-NEXT: headerwithdirname_input.cpp
// CHECK-NEXT: Inputs{{/|\\}}foodir
// CHECK: headerwithdirname_input_clangcl.o
// CHECK-NEXT: headerwithdirname_input_clangcl.cpp
// CHECK-NEXT: Inputs{{/|\\}}foodir
......@@ -7,6 +7,7 @@
// RUN: cp %S/Inputs/header.h %t.dir/foodir/foodirheader.h
// RUN: cp %s %t.dir/headerwithdirname_input.cpp
// RUN: cp %s %t.dir/headerwithdirname_input_clangcl.cpp
// RUN: mkdir %t.dir/Inputs
// RUN: cp %S/Inputs/foodir %t.dir/Inputs/foodir
// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/headerwithdirnamefollowedbyinclude.json > %t.cdb
......@@ -19,3 +20,7 @@
// CHECK: headerwithdirname_input{{\.o|.*\.s}}
// CHECK-NEXT: headerwithdirname_input.cpp
// CHECK-NEXT: Inputs{{/|\\}}foodir
// CHECK: headerwithdirname_input_clangcl.o
// CHECK-NEXT: headerwithdirname_input_clangcl.cpp
// CHECK-NEXT: Inputs{{/|\\}}foodir
......@@ -43,7 +43,7 @@
// CHECK-NEXT: "command-line": [
// CHECK: "-fno-implicit-modules"
// CHECK-NEXT: "-fno-implicit-module-maps"
// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[HASH_H2]]/header2-{{[A-Z0-9]+}}.pcm"
// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H2]]/header2-{{[A-Z0-9]+}}.pcm"
// CHECK-NEXT: ],
// CHECK-NEXT: "file-deps": [
// CHECK-NEXT: "[[PREFIX]]/modules-fmodule-name-no-module-built.m"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment