Skip to content

Commit

Permalink
[libc++/libc++abi] Properly delimit lit substitutions
Browse files Browse the repository at this point in the history
lit is not very clever when it performs substitution on RUN lines. It
simply looks for a match anywhere in the line (without tokenization)
and replaces it by the expansion. This means that a RUN line containing
e.g. `-verify-ignore-unexpected=note` wouod be expanded to
`-verify-ignore-unexpected=<substitution for not>e`, which is
surprising and nonsensical.

It also means that something like `%compile_module` could be expanded
to `<substitution-for-%compile>_module` or to the correct substitution,
depending on the order in which substitutions are evaluated by lit.

To avoid such problems, it is a good habit to delimit custom substitutions
with some token. This commit does that for all substitutions used in the
libc++ and libc++abi test suites.
  • Loading branch information
ldionne committed Mar 27, 2020
1 parent 848112c commit 08776de
Show file tree
Hide file tree
Showing 44 changed files with 106 additions and 106 deletions.
4 changes: 2 additions & 2 deletions libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03
// REQUIRES: libatomic
// RUN: %build -latomic
// RUN: %run
// RUN: %{build} -latomic
// RUN: %{run}
//
// GCC currently fails because it needs -fabi-version=6 to fix mangling of
// std::atomic when used with __attribute__((vector(X))).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

// RUN: %build -fno-exceptions
// RUN: %run
// RUN: %{build} -fno-exceptions
// RUN: %{run}

// UNSUPPORTED: c++98, c++03

Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/depr/depr.c.headers/math_h.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// RUN: %compile -fsyntax-only
// RUN: %{compile} -fsyntax-only

#ifdef _MSC_VER

Expand Down
8 changes: 4 additions & 4 deletions libcxx/test/libcxx/double_include.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

// Test that we can include each header in two TU's and link them together.

// RUN: %cxx -c %s -o %t.first.o %flags %compile_flags
// RUN: %cxx -c %s -o %t.second.o -DWITH_MAIN %flags %compile_flags
// RUN: %cxx -o %t.exe %t.first.o %t.second.o %flags %link_flags
// RUN: %run
// RUN: %{cxx} -c %s -o %t.first.o %{flags} %{compile_flags}
// RUN: %{cxx} -c %s -o %t.second.o -DWITH_MAIN %{flags} %{compile_flags}
// RUN: %{cxx} -o %t.exe %t.first.o %t.second.o %{flags} %{link_flags}
// RUN: %{run}

// Prevent <ext/hash_map> from generating deprecated warnings for this test.
#if defined(__DEPRECATED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

// REQUIRES: fcoroutines-ts

// RUN: %build -fcoroutines-ts
// RUN: %run
// RUN: %{build} -fcoroutines-ts
// RUN: %{run}

// A simple "breathing" test that checks that <experimental/coroutine>
// can be parsed and used in all dialects, including C++03 in order to match
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
// UNSUPPORTED: c++98, c++03, c++11
// REQUIRES: fcoroutines-ts

// RUN: %build -fcoroutines-ts
// RUN: %run
// RUN: %{build} -fcoroutines-ts
// RUN: %{run}

#include <experimental/coroutine>

Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/include_as_c.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// NOTE: It's not common or recommended to have libc++ in the header search
// path when compiling C files, but it does happen often enough.

// RUN: %cxx -c -xc %s -fsyntax-only %flags %compile_flags -std=c99
// RUN: %{cxx} -c -xc %s -fsyntax-only %{flags} %{compile_flags} -std=c99

#include <complex.h>
#include <ctype.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

// class directory_entry

// RUN: %build -I%libcxx_src_root/src/filesystem
// RUN: %run
// RUN: %{build} -I%{libcxx_src_root}/src/filesystem
// RUN: %{run}

#include "filesystem_include.h"
#include <type_traits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

// typedef TrivialClock file_time_type;

// RUN: %build -I%libcxx_src_root/src/filesystem
// RUN: %run
// RUN: %{build} -I%{libcxx_src_root}/src/filesystem
// RUN: %{run}

#include <filesystem>
#include <chrono>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
// GCC doesn't support the aligned-allocation flags.
// XFAIL: gcc

// RUN: %build -faligned-allocation -fsized-deallocation
// RUN: %run
// RUN: %build -faligned-allocation -fno-sized-deallocation -DNO_SIZE
// RUN: %run
// RUN: %build -fno-aligned-allocation -fsized-deallocation -DNO_ALIGN
// RUN: %run
// RUN: %build -fno-aligned-allocation -fno-sized-deallocation -DNO_ALIGN -DNO_SIZE
// RUN: %run
// RUN: %{build} -faligned-allocation -fsized-deallocation
// RUN: %{run}
// RUN: %{build} -faligned-allocation -fno-sized-deallocation -DNO_SIZE
// RUN: %{run}
// RUN: %{build} -fno-aligned-allocation -fsized-deallocation -DNO_ALIGN
// RUN: %{run}
// RUN: %{build} -fno-aligned-allocation -fno-sized-deallocation -DNO_ALIGN -DNO_SIZE
// RUN: %{run}

#include <new>
#include <typeinfo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
// XFAIL: with_system_cxx_lib=macosx10.8
// XFAIL: with_system_cxx_lib=macosx10.7

// RUN: %build -faligned-allocation
// RUN: %run
// RUN: %{build} -faligned-allocation
// RUN: %{run}

#include <new>
#include <typeinfo>
Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/min_max_macros.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// Test that we can include each header in two TU's and link them together.

// RUN: %compile -fsyntax-only
// RUN: %{compile} -fsyntax-only

// Prevent <ext/hash_map> from generating deprecated warnings for this test.
#if defined(__DEPRECATED)
Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/modules/cinttypes_exports.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

// Test that <cinttypes> re-exports <cstdint>

// RUN: %build_module
// RUN: %{build_module}

#include <cinttypes>

Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/modules/clocale_exports.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// REQUIRES: modules-support
// UNSUPPORTED: c++98, c++03

// RUN: %build_module
// RUN: %{build_module}

#include <clocale>

Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/modules/cstdint_exports.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

// Test that <cstdint> re-exports <stdint.h>

// RUN: %build_module
// RUN: %{build_module}

#include <cstdint>

Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/modules/inttypes_h_exports.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

// Test that intypes.h re-exports stdint.h

// RUN: %build_module
// RUN: %{build_module}

#include <inttypes.h>

Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/modules/stdint_h_exports.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// Test that int8_t and the like are exported from stdint.h not inttypes.h

// RUN: %build_module
// RUN: %{build_module}

#include <stdint.h>

Expand Down
14 changes: 7 additions & 7 deletions libcxx/test/libcxx/modules/stds_include.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

// REQUIRES: modules-support

// NOTE: The -std=XXX flag is present in %flags, so we overwrite it by passing it after %flags.
// RUN: %cxx %flags %compile_flags -fmodules -fcxx-modules -fsyntax-only -std=c++98 %s
// RUN: %cxx %flags %compile_flags -fmodules -fcxx-modules -fsyntax-only -std=c++03 %s
// RUN: %cxx %flags %compile_flags -fmodules -fcxx-modules -fsyntax-only -std=c++11 %s
// RUN: %cxx %flags %compile_flags -fmodules -fcxx-modules -fsyntax-only -std=c++14 %s
// RUN: %cxx %flags %compile_flags -fmodules -fcxx-modules -fsyntax-only -std=c++17 %s
// RUN: %cxx %flags %compile_flags -fmodules -fcxx-modules -fsyntax-only -std=c++2a %s
// NOTE: The -std=XXX flag is present in %{flags}, so we overwrite it by passing it after %{flags}.
// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++98 %s
// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++03 %s
// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++11 %s
// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++14 %s
// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++17 %s
// RUN: %{cxx} %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -std=c++2a %s

#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/no_assert_include.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Ensure that none of the standard C++ headers implicitly include cassert or
// assert.h (because assert() is implemented as a macro).

// RUN: %compile -fsyntax-only
// RUN: %{compile} -fsyntax-only

// Prevent <ext/hash_map> from generating deprecated warnings for this test.
#if defined(__DEPRECATED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

// REQUIRES: fdelayed-template-parsing

// RUN: %build -fdelayed-template-parsing
// RUN: %run
// RUN: %{build} -fdelayed-template-parsing
// RUN: %{run}

#include <cmath>
#include <cassert>
Expand Down
4 changes: 2 additions & 2 deletions libcxx/test/libcxx/selftest/exec.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//

// RUN: %build
// RUN: %exec %t.exe "HELLO"
// RUN: %{build}
// RUN: %{exec} %t.exe "HELLO"

#include <cassert>
#include <string>
Expand Down
4 changes: 2 additions & 2 deletions libcxx/test/libcxx/selftest/not_test.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//

// RUN: %build
// RUN: not %run
// RUN: %{build}
// RUN: %{not} %{run}

int main(int, char**)
{
Expand Down
4 changes: 2 additions & 2 deletions libcxx/test/libcxx/selftest/test.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//

// RUN: %build
// RUN: %run
// RUN: %{build}
// RUN: %{run}

int main(int, char**)
{
Expand Down
4 changes: 2 additions & 2 deletions libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

// Regression test for PR42676.

// RUN: %cxx %flags %s -o %t.exe %compile_flags %link_flags -D_LIBCPP_HIDE_FROM_ABI_PER_TU
// RUN: %run
// RUN: %{cxx} %{flags} %s -o %t.exe %{compile_flags} %{link_flags} -D_LIBCPP_HIDE_FROM_ABI_PER_TU
// RUN: %{run}

#include <memory>
#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
// This tests is meant to demonstrate an existing ABI bug between the
// C++03 and C++11 implementations of std::function. It is not a real test.

// RUN: %cxx -c %s -o %t.first.o %flags %compile_flags -std=c++03 -g
// RUN: %cxx -c %s -o %t.second.o -DWITH_MAIN %flags %compile_flags -g -std=c++11
// RUN: %cxx -o %t.exe %t.first.o %t.second.o %flags %link_flags -g
// RUN: %run
// RUN: %{cxx} -c %s -o %t.first.o %{flags} %{compile_flags} -std=c++03 -g
// RUN: %{cxx} -c %s -o %t.second.o -DWITH_MAIN %{flags} %{compile_flags} -g -std=c++11
// RUN: %{cxx} -o %t.exe %t.first.o %t.second.o %{flags} %{link_flags} -g
// RUN: %{run}

#include <functional>
#include <cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
// std::_IsSame: 689.634 ms 356 K
// std::is_same: 8,129.180 ms 560 K
//
// RUN: %cxx %flags %compile_flags -c %s -o %S/orig.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17
// RUN: %cxx %flags %compile_flags -c %s -o %S/new.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17 -DTEST_NEW
// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/orig.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17
// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/new.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17 -DTEST_NEW

#include <type_traits>
#include <cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
// __and_: 14,181.851 ms 648 M
//

// RUN: %cxx %flags %compile_flags -c %s -o %S/new.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17
// RUN: %cxx %flags %compile_flags -c %s -o %S/lazy.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17 -DTEST_LAZY_AND
// RUN: %cxx %flags %compile_flags -c %s -o %S/std.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17 -DTEST_STD_AND
// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/new.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17
// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/lazy.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17 -DTEST_LAZY_AND
// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/std.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17 -DTEST_STD_AND

#include <type_traits>
#include <cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
// variant_new: 1,105 ms 828 KiB


// RUN: %cxx %flags %compile_flags -std=c++17 -c %s \
// RUN: %{cxx} %{flags} %{compile_flags} -std=c++17 -c %s \
// RUN: -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -g \
// RUN: -DTEST_NS=flat_impl -o %S/flat.o
// RUN: %cxx %flags %compile_flags -std=c++17 -c %s \
// RUN: %{cxx} %{flags} %{compile_flags} -std=c++17 -c %s \
// RUN: -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -g \
// RUN: -DTEST_NS=rec_impl -o %S/rec.o
// RUN: %cxx %flags %compile_flags -std=c++17 -c %s \
// RUN: %{cxx} %{flags} %{compile_flags} -std=c++17 -c %s \
// RUN: -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -g \
// RUN: -DTEST_NS=variant_impl -o %S/variant.o

Expand Down
4 changes: 2 additions & 2 deletions libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
// UNSUPPORTED: system-windows
// REQUIRES: libcxx_gdb
//
// RUN: %cxx %flags %s -o %t.exe %compile_flags -g %link_flags
// RUN: %{cxx} %{flags} %s -o %t.exe %{compile_flags} -g %{link_flags}
// Ensure locale-independence for unicode tests.
// RUN: %libcxx_gdb -nx -batch -iex "set autoload off" -ex "source %libcxx_src_root/utils/gdb/libcxx/printers.py" -ex "python register_libcxx_printer_loader()" -ex "source %libcxx_src_root/test/pretty_printers/gdb_pretty_printer_test.py" %t.exe
// RUN: %{libcxx_gdb} -nx -batch -iex "set autoload off" -ex "source %{libcxx_src_root}/utils/gdb/libcxx/printers.py" -ex "python register_libcxx_printer_loader()" -ex "source %{libcxx_src_root}/test/pretty_printers/gdb_pretty_printer_test.py" %t.exe

#include <bitset>
#include <deque>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

// RUN: %build -O2
// RUN: %run
// RUN: %{build} -O2
// RUN: %{run}

// <map>

Expand Down
4 changes: 2 additions & 2 deletions libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// _STD_TYPES_T, stdint.h can be entered to get to macros like UINT32_MAX.
//
// REQUIRES: aix
// RUN: %compile -c
// RUN: %compile -c -D_XOPEN_SOURCE=700
// RUN: %{compile} -c
// RUN: %{compile} -c -D_XOPEN_SOURCE=700

// test <stdint.h>
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8

// REQUIRES: -faligned-allocation
// RUN: %compile %verify -faligned-allocation
// RUN: %{compile} %{verify} -faligned-allocation

#include <new>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8

// REQUIRES: -faligned-allocation
// RUN: %compile %verify -faligned-allocation
// RUN: %{compile} %{verify} -faligned-allocation

#include <new>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8

// REQUIRES: -faligned-allocation
// RUN: %compile %verify -faligned-allocation
// RUN: %{compile} %{verify} -faligned-allocation

#include <new>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8

// REQUIRES: -faligned-allocation
// RUN: %compile %verify -faligned-allocation
// RUN: %{compile} %{verify} -faligned-allocation

#include <new>

Expand Down
Loading

0 comments on commit 08776de

Please sign in to comment.