[libcxx-commits] [libcxx] 1fc5010 - [libc++] Consider everything inside %T to be a dependency of each test
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 10 19:39:39 PDT 2020
Author: Louis Dionne
Date: 2020-06-10T22:38:05-04:00
New Revision: 1fc5010d6b70bb5c2330595230ca5c5fe07bcad0
URL: https://github.com/llvm/llvm-project/commit/1fc5010d6b70bb5c2330595230ca5c5fe07bcad0
DIFF: https://github.com/llvm/llvm-project/commit/1fc5010d6b70bb5c2330595230ca5c5fe07bcad0.diff
LOG: [libc++] Consider everything inside %T to be a dependency of each test
Instead of passing file dependencies individually, assume that the
whole content of the unique test directory is a dependency. This
simplifies the test harness significantly, by making %T the directory
that contains everything required to run a test. This also removes the
need for the %{file_dependencies} substitution, which is removed by this
patch.
Furthermore, this patch also changes the harness to execute tests locally
inside %T, so as to avoid creating a separate directory for no purpose.
Added:
libcxx/test/libcxx/selftest/newformat/file_dependencies/a.txt
libcxx/test/libcxx/selftest/newformat/file_dependencies/absolute-and-relative-paths.sh.cpp
libcxx/test/libcxx/selftest/newformat/file_dependencies/dir/b.txt
Modified:
libcxx/test/libcxx/double_include.sh.cpp
libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
libcxx/test/libcxx/selftest/dsl/lit.local.cfg
libcxx/test/libcxx/selftest/exec.sh.cpp
libcxx/test/libcxx/selftest/newformat/convenience_substitutions/build_run.sh.cpp
libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-dependencies.sh.cpp
libcxx/test/libcxx/selftest/newformat/remote-substitutions.sh.cpp
libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp
libcxx/test/libcxx/selftest/newformat/sh.cpp/werror.sh.cpp
libcxx/test/libcxx/selftest/newformat/shell-escape-pipes.sh.cpp
libcxx/test/libcxx/selftest/test.sh.cpp
libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp
libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
libcxx/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp
libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp
libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp
libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.sh.cpp
libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp
libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wclog.sh.cpp
libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout.sh.cpp
libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
libcxx/utils/libcxx/test/config.py
libcxx/utils/libcxx/test/dsl.py
libcxx/utils/libcxx/test/newformat.py
libcxx/utils/run.py
libcxx/utils/ssh.py
libcxxabi/test/incomplete_type.sh.cpp
Removed:
libcxx/test/libcxx/selftest/newformat/file_dependencies/no-dependencies.sh.cpp
libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-run.sh.cpp
libcxx/test/libcxx/selftest/test.file_dependencies.sh.cpp
################################################################################
diff --git a/libcxx/test/libcxx/double_include.sh.cpp b/libcxx/test/libcxx/double_include.sh.cpp
index f56e2ec9fa70..37fa0e5c8c7b 100644
--- a/libcxx/test/libcxx/double_include.sh.cpp
+++ b/libcxx/test/libcxx/double_include.sh.cpp
@@ -9,7 +9,6 @@
// Test that we can include each header in two TU's and link them together.
-// FILE_DEPENDENCIES: %t.exe
// 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}
diff --git a/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp b/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
index 39af4dd1e3df..6ed7e7536bb7 100644
--- a/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
+++ b/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
@@ -35,7 +35,6 @@
// GCC doesn't support the aligned-allocation flags.
// XFAIL: gcc
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build} -faligned-allocation -fsized-deallocation
// RUN: %{run}
// RUN: %{build} -faligned-allocation -fno-sized-deallocation -DNO_SIZE
diff --git a/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp b/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
index 08e3eb67af8b..ae6efea8b17b 100644
--- a/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
+++ b/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
@@ -8,7 +8,6 @@
// UNSUPPORTED: -fno-rtti
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.tu1.o -DTU1 -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=1
// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.tu2.o -DTU2 -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=1
// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.main.o -DMAIN -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=1
diff --git a/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp b/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
index e81a1b0e3437..1fb9bc3a9b41 100644
--- a/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
+++ b/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
@@ -8,7 +8,6 @@
// UNSUPPORTED: -fno-rtti
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.tu1.o -DTU1 -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=2
// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.tu2.o -DTU2 -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=2
// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.main.o -DMAIN -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=2
diff --git a/libcxx/test/libcxx/selftest/dsl/lit.local.cfg b/libcxx/test/libcxx/selftest/dsl/lit.local.cfg
index 8cf3543690f4..6613900fb544 100644
--- a/libcxx/test/libcxx/selftest/dsl/lit.local.cfg
+++ b/libcxx/test/libcxx/selftest/dsl/lit.local.cfg
@@ -1,10 +1,9 @@
# Since we try to pass substitutions as-is to some tests, we must "escape"
# them in case they contain other substitutions. Otherwise, the substitutions
# will be fully expanded when passed to the tests. For example, we want an
-# %{exec} substitution that contains `--dependencies %{file_dependencies}`
-# to be passed as-is, without substituting the file dependencies. This way,
-# the test itself can use populate %{file_dependencies} as it sees fit, and
-# %{exec} will respect it.
+# %{exec} substitution that contains `--execdir %T` to be passed as-is, without
+# substituting the directory. This way, the test itself can populate %T as it
+# sees fit, and %{exec} will respect it.
#
# To solve this problem, we add base64 encoded versions of substitutions just
# in this directory. We then base64-decode them from the tests when we need to.
diff --git a/libcxx/test/libcxx/selftest/exec.sh.cpp b/libcxx/test/libcxx/selftest/exec.sh.cpp
index de42de3e7df2..19c3d590978b 100644
--- a/libcxx/test/libcxx/selftest/exec.sh.cpp
+++ b/libcxx/test/libcxx/selftest/exec.sh.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// FILE_DEPENDENCIES: %t.exe
-
// RUN: %{build}
// RUN: %{exec} %t.exe "HELLO"
diff --git a/libcxx/test/libcxx/selftest/newformat/convenience_substitutions/build_run.sh.cpp b/libcxx/test/libcxx/selftest/newformat/convenience_substitutions/build_run.sh.cpp
index e050f88cf009..4698167449f1 100644
--- a/libcxx/test/libcxx/selftest/newformat/convenience_substitutions/build_run.sh.cpp
+++ b/libcxx/test/libcxx/selftest/newformat/convenience_substitutions/build_run.sh.cpp
@@ -8,7 +8,6 @@
// Make sure that we provide the %{build} and %{run} convenience substitutions.
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build}
// RUN: %{run} "HELLO"
diff --git a/libcxx/test/libcxx/selftest/newformat/file_dependencies/a.txt b/libcxx/test/libcxx/selftest/newformat/file_dependencies/a.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/libcxx/test/libcxx/selftest/test.file_dependencies.sh.cpp b/libcxx/test/libcxx/selftest/newformat/file_dependencies/absolute-and-relative-paths.sh.cpp
similarity index 66%
rename from libcxx/test/libcxx/selftest/test.file_dependencies.sh.cpp
rename to libcxx/test/libcxx/selftest/newformat/file_dependencies/absolute-and-relative-paths.sh.cpp
index 5974393b1370..ac52f67dfac3 100644
--- a/libcxx/test/libcxx/selftest/test.file_dependencies.sh.cpp
+++ b/libcxx/test/libcxx/selftest/newformat/file_dependencies/absolute-and-relative-paths.sh.cpp
@@ -1,4 +1,3 @@
-// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -7,8 +6,10 @@
//
//===----------------------------------------------------------------------===//
-// FILE_DEPENDENCIES: test.pass.cpp
-// FILE_DEPENDENCIES: %s
+// Make sure that FILE_DEPENDENCIES work with relative AND absolute paths.
-// RUN: echo %{file_dependencies} | grep 'test.pass.cpp'
-// RUN: echo %{file_dependencies} | grep '%s'
+// FILE_DEPENDENCIES: %S/a.txt
+// RUN: test -e %T/a.txt
+
+// FILE_DEPENDENCIES: dir/b.txt
+// RUN: test -e %T/b.txt
diff --git a/libcxx/test/libcxx/selftest/newformat/file_dependencies/dir/b.txt b/libcxx/test/libcxx/selftest/newformat/file_dependencies/dir/b.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/libcxx/test/libcxx/selftest/newformat/file_dependencies/no-dependencies.sh.cpp b/libcxx/test/libcxx/selftest/newformat/file_dependencies/no-dependencies.sh.cpp
deleted file mode 100644
index adfb15ad50dd..000000000000
--- a/libcxx/test/libcxx/selftest/newformat/file_dependencies/no-dependencies.sh.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Make sure that %{file_dependencies} is empty when no FILE_DEPENDENCIES
-// line appears. Amongst other things, this makes sure that we don't share
-// file dependencies across unrelated Lit tests.
-
-// RUN: test -z "%{file_dependencies}"
diff --git a/libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-dependencies.sh.cpp b/libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-dependencies.sh.cpp
index 291afcb333c0..c63684c7834d 100644
--- a/libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-dependencies.sh.cpp
+++ b/libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-dependencies.sh.cpp
@@ -9,4 +9,4 @@
// Make sure that lit substitutions are expanded inside FILE_DEPENDENCIES lines.
// FILE_DEPENDENCIES: %s
-// RUN: echo %{file_dependencies} | grep 'substitute-in-dependencies.sh.cpp'
+// RUN: test -e %T/substitute-in-dependencies.sh.cpp
diff --git a/libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-run.sh.cpp b/libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-run.sh.cpp
deleted file mode 100644
index 5bd0e335cd29..000000000000
--- a/libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-run.sh.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Make sure %{file_dependencies} are substituted properly into RUN commands.
-
-// FILE_DEPENDENCIES: a.txt
-// FILE_DEPENDENCIES: b.txt, c.txt
-// FILE_DEPENDENCIES: /absolute/d.txt
-// RUN: echo %{file_dependencies} | grep 'a.txt'
-// RUN: echo %{file_dependencies} | grep 'b.txt'
-// RUN: echo %{file_dependencies} | grep 'c.txt'
-// RUN: echo %{file_dependencies} | grep '/absolute/d.txt'
diff --git a/libcxx/test/libcxx/selftest/newformat/remote-substitutions.sh.cpp b/libcxx/test/libcxx/selftest/newformat/remote-substitutions.sh.cpp
index 97c30a688567..644086f83a65 100644
--- a/libcxx/test/libcxx/selftest/newformat/remote-substitutions.sh.cpp
+++ b/libcxx/test/libcxx/selftest/newformat/remote-substitutions.sh.cpp
@@ -15,7 +15,6 @@
// We also check that the path of test-executables is replaced whether they
// appear first in the command-line or not.
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe
// RUN: %{exec} %t.exe 0
// RUN: %{exec} ! %t.exe 1
diff --git a/libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp b/libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp
index e83d9ba10254..da69663bdd81 100644
--- a/libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp
+++ b/libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp
@@ -13,7 +13,6 @@
// - %{link_flags}
// - %{exec}
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe
// RUN: %{exec} %t.exe "HELLO"
diff --git a/libcxx/test/libcxx/selftest/newformat/sh.cpp/werror.sh.cpp b/libcxx/test/libcxx/selftest/newformat/sh.cpp/werror.sh.cpp
index 5b84275bf687..b66179810692 100644
--- a/libcxx/test/libcxx/selftest/newformat/sh.cpp/werror.sh.cpp
+++ b/libcxx/test/libcxx/selftest/newformat/sh.cpp/werror.sh.cpp
@@ -14,7 +14,6 @@
// TODO: We don't enable -Werror on GCC right now, because too many tests fail.
// UNSUPPORTED: gcc
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build} -Wunused-variable
// RUN: %{run}
diff --git a/libcxx/test/libcxx/selftest/newformat/shell-escape-pipes.sh.cpp b/libcxx/test/libcxx/selftest/newformat/shell-escape-pipes.sh.cpp
index 3badc8c39ee5..194ad53da53b 100644
--- a/libcxx/test/libcxx/selftest/newformat/shell-escape-pipes.sh.cpp
+++ b/libcxx/test/libcxx/selftest/newformat/shell-escape-pipes.sh.cpp
@@ -16,7 +16,6 @@
// %{exec}, the one
diff erence we can rely on is that we're in a temporary
// directory with all file dependencies satisfied, so that's what we use.
-// FILE_DEPENDENCIES: %t.foobar
// RUN: touch %t.foobar
// RUN: %{exec} echo \| ls > %t.out
// RUN: grep -e ".foobar" %t.out
diff --git a/libcxx/test/libcxx/selftest/test.sh.cpp b/libcxx/test/libcxx/selftest/test.sh.cpp
index ad75f0227e81..5c4db16d84d1 100644
--- a/libcxx/test/libcxx/selftest/test.sh.cpp
+++ b/libcxx/test/libcxx/selftest/test.sh.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// FILE_DEPENDENCIES: %t.exe
-
// RUN: %{build}
// RUN: %{run}
diff --git a/libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp b/libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp
index 18faaf02871d..31bf81efa004 100644
--- a/libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp
@@ -8,7 +8,6 @@
// Regression test for PR42676.
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{cxx} %{flags} %s -o %t.exe %{compile_flags} %{link_flags} -D_LIBCPP_HIDE_FROM_ABI_PER_TU
// RUN: %{run}
diff --git a/libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp b/libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
index 844f8b0d75d4..33c11651f12f 100644
--- a/libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
+++ b/libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
@@ -14,7 +14,6 @@
// on Darwin out-of-the-box.
// REQUIRES: has-fblocks && darwin
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build} -fblocks
// RUN: %{run}
diff --git a/libcxx/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp b/libcxx/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
index ee230cc5857d..4181bc5cba03 100644
--- a/libcxx/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
+++ b/libcxx/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
@@ -8,7 +8,6 @@
// UNSUPPORTED: c++03
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build} -O2
// RUN: %{run}
diff --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp
index 650537dcb20c..16f2b85f07e1 100644
--- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp
@@ -10,7 +10,6 @@
// istream cerr;
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build}
// RUN: %{exec} %t.exe 2> %t.err
// RUN: grep -e 'Hello World!' %t.err
diff --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
index 4cadde65543b..c2bbd360490b 100644
--- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
@@ -12,7 +12,6 @@
// istream cin;
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build}
// RUN: %{exec} echo "123" \| %t.exe > %t.out
// RUN: grep -e 'The number is 123!' %t.out
diff --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp
index 32e23bf61c34..0e3faba853f1 100644
--- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp
@@ -10,7 +10,6 @@
// istream clog;
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build}
// RUN: %{exec} %t.exe 2> %t.err
// RUN: grep -e 'Hello World!' %t.err
diff --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp
index f4a066b5c50d..8f65b9523b4a 100644
--- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp
@@ -12,7 +12,6 @@
// istream cout;
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build}
// RUN: %{exec} %t.exe > %t.out
// RUN: grep -e 'Hello World!' %t.out
diff --git a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.sh.cpp b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.sh.cpp
index 30974df3951f..3ce65cb087ac 100644
--- a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.sh.cpp
@@ -10,7 +10,6 @@
// istream wcerr;
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build}
// RUN: %{exec} %t.exe 2> %t.err
// RUN: grep -e 'Hello World!' %t.err
diff --git a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp
index 0d0ab7e03931..197c1bd6c22b 100644
--- a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp
@@ -12,7 +12,6 @@
// istream wcin;
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build}
// RUN: %{exec} echo "123" \| %t.exe > %t.out
// RUN: grep -e 'The number is 123!' %t.out
diff --git a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wclog.sh.cpp b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wclog.sh.cpp
index d1b126067155..34a4913a04c3 100644
--- a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wclog.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wclog.sh.cpp
@@ -10,7 +10,6 @@
// istream wclog;
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build}
// RUN: %{exec} %t.exe 2> %t.err
// RUN: grep -e 'Hello World!' %t.err
diff --git a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout.sh.cpp b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout.sh.cpp
index 0a14f898baa2..577b0c95ba37 100644
--- a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout.sh.cpp
@@ -12,7 +12,6 @@
// istream wcout;
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build}
// RUN: %{exec} %t.exe > %t.out
// RUN: grep -e 'Hello World!' %t.out
diff --git a/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp b/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
index 2d6e962f6dce..f4bb2b71bc79 100644
--- a/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
+++ b/libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
@@ -13,7 +13,6 @@
// class condition_variable_any;
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{build}
// RUN: %{run} 1
// RUN: %{run} 2
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 118cb896e9c2..5eccc2783a74 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -747,15 +747,14 @@ def configure_substitutions(self):
codesign_ident = self.get_lit_conf('llvm_codesign_identity', '')
env_vars = ' '.join('%s=%s' % (k, pipes.quote(v)) for (k, v) in self.exec_env.items())
exec_args = [
+ '--execdir %T',
'--codesign_identity "{}"'.format(codesign_ident),
- '--dependencies %{file_dependencies}',
'--env {}'.format(env_vars)
]
if isinstance(self.executor, SSHExecutor):
exec_args.append('--host {}'.format(self.executor.user_prefix + self.executor.host))
executor = os.path.join(self.libcxx_src_root, 'utils', 'ssh.py')
else:
- exec_args.append('--execdir %t.execdir')
executor = os.path.join(self.libcxx_src_root, 'utils', 'run.py')
sub.append(('%{exec}', '{} {} {} -- '.format(pipes.quote(sys.executable),
pipes.quote(executor),
diff --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py
index f3add443093b..21b48af8f0ac 100644
--- a/libcxx/utils/libcxx/test/dsl.py
+++ b/libcxx/utils/libcxx/test/dsl.py
@@ -70,9 +70,9 @@ def sourceBuilds(config, source):
"mkdir -p %T",
"%{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe"
]
- commands = libcxx.test.newformat.parseScript(test, preamble=commands, fileDependencies=['%t.exe'])
+ commands = libcxx.test.newformat.parseScript(test, preamble=commands)
out, err, exitCode, timeoutInfo = _executeScriptInternal(test, commands)
- cleanup = libcxx.test.newformat.parseScript(test, preamble=['rm %t.exe'], fileDependencies=[])
+ cleanup = libcxx.test.newformat.parseScript(test, preamble=['rm %t.exe'])
_executeScriptInternal(test, cleanup)
return exitCode == 0
@@ -85,7 +85,7 @@ def hasCompileFlag(config, flag):
"""
with _makeConfigTest(config) as test:
commands = ["%{{cxx}} -xc++ {} -Werror -fsyntax-only %{{flags}} %{{compile_flags}} {}".format(os.devnull, flag)]
- commands = libcxx.test.newformat.parseScript(test, preamble=commands, fileDependencies=[])
+ commands = libcxx.test.newformat.parseScript(test, preamble=commands)
out, err, exitCode, timeoutInfo = _executeScriptInternal(test, commands)
return exitCode == 0
@@ -111,9 +111,9 @@ def hasLocale(config, locale):
"%{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe",
"%{{exec}} %t.exe {}".format(pipes.quote(locale)),
]
- commands = libcxx.test.newformat.parseScript(test, preamble=commands, fileDependencies=['%t.exe'])
+ commands = libcxx.test.newformat.parseScript(test, preamble=commands)
out, err, exitCode, timeoutInfo = _executeScriptInternal(test, commands)
- cleanup = libcxx.test.newformat.parseScript(test, preamble=['rm %t.exe'], fileDependencies=[])
+ cleanup = libcxx.test.newformat.parseScript(test, preamble=['rm %t.exe'])
_executeScriptInternal(test, cleanup)
return exitCode == 0
@@ -129,7 +129,7 @@ def compilerMacros(config, flags=''):
"""
with _makeConfigTest(config) as test:
commands = ["%{{cxx}} -xc++ {} -dM -E %{{flags}} %{{compile_flags}} {}".format(os.devnull, flags)]
- commands = libcxx.test.newformat.parseScript(test, preamble=commands, fileDependencies=[])
+ commands = libcxx.test.newformat.parseScript(test, preamble=commands)
unparsedOutput, err, exitCode, timeoutInfo = _executeScriptInternal(test, commands)
parsedMacros = dict()
defines = (l.strip() for l in unparsedOutput.split('\n') if l.startswith('#define '))
diff --git a/libcxx/utils/libcxx/test/newformat.py b/libcxx/utils/libcxx/test/newformat.py
index 43b11a40f0a4..4390166ca6bf 100644
--- a/libcxx/utils/libcxx/test/newformat.py
+++ b/libcxx/utils/libcxx/test/newformat.py
@@ -11,6 +11,7 @@
import os
import pipes
import re
+import shutil
import subprocess
def _supportsVerify(config):
@@ -40,7 +41,7 @@ def _getTempPaths(test):
tmpBase = os.path.join(tmpDir, 't')
return tmpDir, tmpBase
-def parseScript(test, preamble, fileDependencies):
+def parseScript(test, preamble):
"""
Extract the script from a test, with substitutions applied.
@@ -54,9 +55,6 @@ def parseScript(test, preamble, fileDependencies):
These commands can contain unexpanded substitutions, but they
must not be of the form 'RUN:' -- they must be proper commands
once substituted.
-
- - fileDependencies
- A list of additional file dependencies for the test.
"""
# Get the default substitutions
@@ -71,7 +69,7 @@ def parseScript(test, preamble, fileDependencies):
# Parse the test file, including custom directives
additionalCompileFlags = []
- fileDependencies = list(fileDependencies)
+ fileDependencies = []
parsers = [
lit.TestRunner.IntegratedTestKeywordParser('FILE_DEPENDENCIES:',
lit.TestRunner.ParserKind.LIST,
@@ -81,30 +79,25 @@ def parseScript(test, preamble, fileDependencies):
initial_value=additionalCompileFlags)
]
- script = list(preamble)
- parsed = lit.TestRunner.parseIntegratedTestScript(test, additional_parsers=parsers,
- require_script=not script)
- if isinstance(parsed, lit.Test.Result):
- return parsed
- script += parsed
+ scriptInTest = lit.TestRunner.parseIntegratedTestScript(test, additional_parsers=parsers,
+ require_script=not preamble)
+ if isinstance(scriptInTest, lit.Test.Result):
+ return scriptInTest
+
+ script = []
+
+ # For each file dependency in FILE_DEPENDENCIES, inject a command to copy
+ # that file to the execution directory. Execute the copy from %S to allow
+ # relative paths from the test directory.
+ for dep in fileDependencies:
+ script += ['%dbg(SETUP) cd %S && cp {} %T'.format(dep)]
+ script += preamble
+ script += scriptInTest
# Add compile flags specified with ADDITIONAL_COMPILE_FLAGS.
substitutions = [(s, x + ' ' + ' '.join(additionalCompileFlags)) if s == '%{compile_flags}'
else (s, x) for (s, x) in substitutions]
- # Perform substitutions inside FILE_DEPENDENCIES lines (or injected dependencies).
- # This allows using variables like %t in file dependencies. Also note that we really
- # need to resolve %{file_dependencies} now, because otherwise we won't be able to
- # make all paths absolute below.
- fileDependencies = lit.TestRunner.applySubstitutions(fileDependencies, substitutions,
- recursion_limit=test.config.recursiveExpansionLimit)
-
- # Add the %{file_dependencies} substitution before we perform substitutions
- # inside the script.
- testDir = os.path.dirname(test.getSourcePath())
- fileDependencies = [f if os.path.isabs(f) else os.path.join(testDir, f) for f in fileDependencies]
- substitutions.append(('%{file_dependencies}', ' '.join(map(pipes.quote, fileDependencies))))
-
# Perform substitutions in the script itself.
script = lit.TestRunner.applySubstitutions(script, substitutions,
recursion_limit=test.config.recursiveExpansionLimit)
@@ -170,11 +163,10 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
This directive expresses that the test requires the provided files
or directories in order to run. An example is a test that requires
some test input stored in a data file. When a test file contains
- such a directive, this test format will collect them and make them
- available in a special %{file_dependencies} substitution. The intent
- is that if one needs to e.g. execute tests on a remote host, the
- %{exec} substitution could use %{file_dependencies} to know which
- files and directories to copy to the remote host.
+ such a directive, this test format will collect them and copy them
+ to the directory represented by %T. The intent is that %T contains
+ all the inputs necessary to run the test, such that e.g. execution
+ on a remote host can be done by simply copying %T to the host.
// ADDITIONAL_COMPILE_FLAGS: flag1, flag2, flag3
@@ -188,11 +180,6 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
==============================================
The test format will define the following substitutions for use inside tests:
- %{file_dependencies}
-
- Expands to the list of files that this test depends on.
- See FILE_DEPENDENCIES above.
-
%{build}
Expands to a command-line that builds the current source
file with the %{flags}, %{compile_flags} and %{link_flags}
@@ -273,7 +260,7 @@ def execute(self, test, litConfig):
"%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe",
"%dbg(EXECUTED AS) %{exec} ! %t.exe"
]
- return self._executeShTest(test, litConfig, steps, fileDependencies=['%t.exe'])
+ return self._executeShTest(test, litConfig, steps)
elif filename.endswith('.verify.cpp'):
if not supportsVerify:
return lit.Test.Result(lit.Test.UNSUPPORTED,
@@ -291,7 +278,7 @@ def execute(self, test, litConfig):
"%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe",
"%dbg(EXECUTED AS) %{exec} %t.exe"
]
- return self._executeShTest(test, litConfig, steps, fileDependencies=['%t.exe'])
+ return self._executeShTest(test, litConfig, steps)
# This is like a .verify.cpp test when clang-verify is supported,
# otherwise it's like a .compile.fail.cpp test. This is only provided
# for backwards compatibility with the test suite.
@@ -313,11 +300,11 @@ def addCompileFlags(self, config, *flags):
string = ' '.join(flags)
config.substitutions = [(s, x + ' ' + string) if s == '%{compile_flags}' else (s, x) for (s, x) in config.substitutions]
- def _executeShTest(self, test, litConfig, steps, fileDependencies=None):
+ def _executeShTest(self, test, litConfig, steps):
if test.config.unsupported:
return lit.Test.Result(lit.Test.UNSUPPORTED, 'Test is unsupported')
- script = parseScript(test, steps, fileDependencies or [])
+ script = parseScript(test, steps)
if isinstance(script, lit.Test.Result):
return script
diff --git a/libcxx/utils/run.py b/libcxx/utils/run.py
index 0453e4a1f018..e91836b96886 100644
--- a/libcxx/utils/run.py
+++ b/libcxx/utils/run.py
@@ -13,8 +13,6 @@
"""
import argparse
-import os
-import shutil
import subprocess
import sys
@@ -23,7 +21,6 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('--execdir', type=str, required=True)
parser.add_argument('--codesign_identity', type=str, required=False, default=None)
- parser.add_argument('--dependencies', type=str, nargs='*', required=False, default=[])
parser.add_argument('--env', type=str, nargs='*', required=False, default=dict())
(args, remaining) = parser.parse_known_args(sys.argv[1:])
@@ -43,24 +40,8 @@ def main():
# Extract environment variables into a dictionary
env = {k : v for (k, v) in map(lambda s: s.split('=', 1), args.env)}
- # Create the execution directory, and make sure we remove it at the end.
- try:
- os.makedirs(args.execdir)
-
- # Ensure the file dependencies exist and copy them to the execution directory.
- for dep in args.dependencies:
- if not os.path.exists(dep):
- sys.stderr.write('Missing file or directory "{}" marked as a dependency of a test'.format(dep))
- exit(1)
- if os.path.isdir(dep):
- shutil.copytree(dep, os.path.join(args.execdir, os.path.basename(dep)), symlinks=True)
- else:
- shutil.copy2(dep, args.execdir)
-
- # Run the command line with the given environment in the execution directory.
- return subprocess.call(subprocess.list2cmdline(commandLine), cwd=args.execdir, env=env, shell=True)
- finally:
- shutil.rmtree(args.execdir)
+ # Run the command line with the given environment in the execution directory.
+ return subprocess.call(subprocess.list2cmdline(commandLine), cwd=args.execdir, env=env, shell=True)
if __name__ == '__main__':
diff --git a/libcxx/utils/ssh.py b/libcxx/utils/ssh.py
index 50c6f4526cb5..314b13b0da10 100644
--- a/libcxx/utils/ssh.py
+++ b/libcxx/utils/ssh.py
@@ -25,8 +25,8 @@
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--host', type=str, required=True)
+ parser.add_argument('--execdir', type=str, required=True)
parser.add_argument('--codesign_identity', type=str, required=False, default=None)
- parser.add_argument('--dependencies', type=str, nargs='*', required=False, default=[])
parser.add_argument('--env', type=str, nargs='*', required=False, default=dict())
(args, remaining) = parser.parse_known_args(sys.argv[1:])
@@ -40,6 +40,7 @@ def main():
scp = lambda src, dst: ['scp', '-q', '-oBatchMode=yes', src, '{}:{}'.format(args.host, dst)]
# Create a temporary directory where the test will be run.
+ # That is effectively the value of %T on the remote host.
tmp = subprocess.check_output(ssh('mktemp -d /tmp/libcxx.XXXXXXXXXX'), universal_newlines=True).strip()
# HACK:
@@ -58,16 +59,12 @@ def main():
for exe in filter(isTestExe, commandLine):
subprocess.check_call(['xcrun', 'codesign', '-f', '-s', args.codesign_identity, exe], env={})
- # Ensure the test dependencies exist, tar them up and copy the tarball
- # over to the remote host.
+ # tar up the execution directory (which contains everything that's needed
+ # to run the test), and copy the tarball over to the remote host.
try:
tmpTar = tempfile.NamedTemporaryFile(suffix='.tar', delete=False)
with tarfile.open(fileobj=tmpTar, mode='w') as tarball:
- for dep in args.dependencies:
- if not os.path.exists(dep):
- sys.stderr.write('Missing file or directory "{}" marked as a dependency of a test'.format(dep))
- return 1
- tarball.add(dep, arcname=os.path.basename(dep))
+ tarball.add(args.execdir, arcname=os.path.basename(args.execdir))
# Make sure we close the file before we scp it, because accessing
# the temporary file while still open doesn't work on Windows.
@@ -82,7 +79,7 @@ def main():
# Untar the dependencies in the temporary directory and remove the tarball.
remoteCommands = [
- 'tar -xf {} -C {}'.format(remoteTarball, tmp),
+ 'tar -xf {} -C {} --strip-components 1'.format(remoteTarball, tmp),
'rm {}'.format(remoteTarball)
]
@@ -95,8 +92,7 @@ def main():
# Execute the command through SSH in the temporary directory, with the
# correct environment. We tweak the command line to run it on the remote
# host by transforming the path of test-executables to their path in the
- # temporary directory, where we know they have been copied when we handled
- # test dependencies above.
+ # temporary directory on the remote host.
commandLine = (pathOnRemote(x) if isTestExe(x) else x for x in commandLine)
remoteCommands.append('cd {}'.format(tmp))
if args.env:
diff --git a/libcxxabi/test/incomplete_type.sh.cpp b/libcxxabi/test/incomplete_type.sh.cpp
index 20deb16011f0..41d003a75595 100644
--- a/libcxxabi/test/incomplete_type.sh.cpp
+++ b/libcxxabi/test/incomplete_type.sh.cpp
@@ -19,7 +19,6 @@
// in the system libc++abi installation on OS X. (DYLD_LIBRARY_PATH is ignored
// for shell tests because of Apple security features).
-// FILE_DEPENDENCIES: %t.exe
// RUN: %{cxx} %{flags} %{compile_flags} -Wno-unreachable-code -c %s -o %t.one.o
// RUN: %{cxx} %{flags} %{compile_flags} -Wno-unreachable-code -c %s -o %t.two.o -DTU_ONE
// RUN: %{cxx} %{flags} %t.one.o %t.two.o %{link_libcxxabi} %{link_flags} -o %t.exe
More information about the libcxx-commits
mailing list