Skip to content

Commit 5e3ab8f

Browse files
committed
Revert "[libc++] [test] Generate static_test_env on the fly"
This reverts commit 52cc8ba. As the discussion in https://reviews.llvm.org/D78200 continues, I will revert this until we figure out what to do.
1 parent dc4e25d commit 5e3ab8f

File tree

60 files changed

+426
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+426
-519
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dne

libcxx/test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/afile3

Whitespace-only changes.

libcxx/test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/dir3/file5

Whitespace-only changes.

libcxx/test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/file4

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dir3

libcxx/test/std/input.output/filesystems/Inputs/static_test_env/dir1/file1

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

libcxx/test/std/input.output/filesystems/Inputs/static_test_env/empty_file

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dir1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
empty_file

libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/path.pass.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// FILE_DEPENDENCIES: ../../Inputs/static_test_env
910
// UNSUPPORTED: c++98, c++03
1011

1112
// <filesystem>
@@ -45,7 +46,6 @@ TEST_CASE(path_ctor) {
4546
}
4647

4748
TEST_CASE(path_ec_ctor) {
48-
static_test_env static_env;
4949
using namespace fs;
5050
{
5151
static_assert(
@@ -61,8 +61,8 @@ TEST_CASE(path_ec_ctor) {
6161
}
6262
{
6363
std::error_code ec = GetTestEC();
64-
const directory_entry e(static_env.File, ec);
65-
TEST_CHECK(e.path() == static_env.File);
64+
const directory_entry e(StaticEnv::File, ec);
65+
TEST_CHECK(e.path() == StaticEnv::File);
6666
TEST_CHECK(!ec);
6767
}
6868
{
@@ -121,28 +121,26 @@ TEST_CASE(path_ctor_calls_refresh) {
121121
TEST_CASE(path_ctor_dne) {
122122
using namespace fs;
123123

124-
static_test_env static_env;
125-
126124
{
127125
std::error_code ec = GetTestEC();
128-
directory_entry ent(static_env.DNE, ec);
126+
directory_entry ent(StaticEnv::DNE, ec);
129127
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
130-
TEST_CHECK(ent.path() == static_env.DNE);
128+
TEST_CHECK(ent.path() == StaticEnv::DNE);
131129
}
132130
// don't report dead symlinks as an error.
133131
{
134132
std::error_code ec = GetTestEC();
135-
directory_entry ent(static_env.BadSymlink, ec);
133+
directory_entry ent(StaticEnv::BadSymlink, ec);
136134
TEST_CHECK(!ec);
137-
TEST_CHECK(ent.path() == static_env.BadSymlink);
135+
TEST_CHECK(ent.path() == StaticEnv::BadSymlink);
138136
}
139137
// DNE does not cause the constructor to throw
140138
{
141-
directory_entry ent(static_env.DNE);
142-
TEST_CHECK(ent.path() == static_env.DNE);
139+
directory_entry ent(StaticEnv::DNE);
140+
TEST_CHECK(ent.path() == StaticEnv::DNE);
143141

144-
directory_entry ent_two(static_env.BadSymlink);
145-
TEST_CHECK(ent_two.path() == static_env.BadSymlink);
142+
directory_entry ent_two(StaticEnv::BadSymlink);
143+
TEST_CHECK(ent_two.path() == StaticEnv::BadSymlink);
146144
}
147145
}
148146

libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// FILE_DEPENDENCIES: ../../Inputs/static_test_env
910
// UNSUPPORTED: c++98, c++03
1011

1112
// <filesystem>
@@ -53,7 +54,6 @@ TEST_CASE(test_replace_filename_method) {
5354
TEST_CASE(test_replace_filename_ec_method) {
5455
using namespace fs;
5556

56-
static_test_env static_env;
5757
{
5858
directory_entry e;
5959
path replace;
@@ -76,9 +76,9 @@ TEST_CASE(test_replace_filename_ec_method) {
7676
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
7777
}
7878
{
79-
const path p = static_env.EmptyFile;
80-
const path expect = static_env.NonEmptyFile;
81-
const path replace = static_env.NonEmptyFile.filename();
79+
const path p = StaticEnv::EmptyFile;
80+
const path expect = StaticEnv::NonEmptyFile;
81+
const path replace = StaticEnv::NonEmptyFile.filename();
8282
TEST_REQUIRE(expect.parent_path() == p.parent_path());
8383
directory_entry e(p);
8484
TEST_CHECK(e.path() == p);

libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// FILE_DEPENDENCIES: ../../Inputs/static_test_env
910
// UNSUPPORTED: c++98, c++03
1011

1112
// <filesystem>
@@ -111,7 +112,6 @@ TEST_CASE(not_regular_file) {
111112
TEST_CASE(error_reporting) {
112113
using namespace fs;
113114

114-
static_test_env static_env;
115115
scoped_test_env env;
116116

117117
const path dir = env.create_dir("dir");
@@ -127,15 +127,15 @@ TEST_CASE(error_reporting) {
127127
directory_entry ent;
128128

129129
std::error_code ec = GetTestEC();
130-
ent.assign(static_env.DNE, ec);
131-
TEST_REQUIRE(ent.path() == static_env.DNE);
130+
ent.assign(StaticEnv::DNE, ec);
131+
TEST_REQUIRE(ent.path() == StaticEnv::DNE);
132132
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
133133

134134
ec = GetTestEC();
135135
TEST_CHECK(ent.file_size(ec) == uintmax_t(-1));
136136
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
137137

138-
ExceptionChecker Checker(static_env.DNE,
138+
ExceptionChecker Checker(StaticEnv::DNE,
139139
std::errc::no_such_file_or_directory,
140140
"directory_entry::file_size");
141141
TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.file_size());
@@ -145,20 +145,20 @@ TEST_CASE(error_reporting) {
145145
directory_entry ent;
146146

147147
std::error_code ec = GetTestEC();
148-
uintmax_t expect_bad = file_size(static_env.BadSymlink, ec);
148+
uintmax_t expect_bad = file_size(StaticEnv::BadSymlink, ec);
149149
TEST_CHECK(expect_bad == uintmax_t(-1));
150150
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
151151

152152
ec = GetTestEC();
153-
ent.assign(static_env.BadSymlink, ec);
154-
TEST_REQUIRE(ent.path() == static_env.BadSymlink);
153+
ent.assign(StaticEnv::BadSymlink, ec);
154+
TEST_REQUIRE(ent.path() == StaticEnv::BadSymlink);
155155
TEST_CHECK(!ec);
156156

157157
ec = GetTestEC();
158158
TEST_CHECK(ent.file_size(ec) == expect_bad);
159159
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
160160

161-
ExceptionChecker Checker(static_env.BadSymlink,
161+
ExceptionChecker Checker(StaticEnv::BadSymlink,
162162
std::errc::no_such_file_or_directory,
163163
"directory_entry::file_size");
164164
TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.file_size());

libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ TEST_CASE(test_with_ec_dne) {
149149
using fs::directory_entry;
150150
using fs::file_status;
151151
using fs::path;
152-
static_test_env static_env;
153-
for (auto p : {static_env.DNE, static_env.BadSymlink}) {
152+
153+
for (auto p : {StaticEnv::DNE, StaticEnv::BadSymlink}) {
154154

155155
directory_entry e(p);
156156
std::error_code status_ec = GetTestEC();

libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// FILE_DEPENDENCIES: ../../Inputs/static_test_env
910
// UNSUPPORTED: c++98, c++03
1011

1112
// <filesystem>
@@ -109,7 +110,6 @@ TEST_CASE(not_regular_file) {
109110
TEST_CASE(error_reporting) {
110111
using namespace fs;
111112

112-
static_test_env static_env;
113113
scoped_test_env env;
114114

115115
const path dir = env.create_dir("dir");
@@ -125,16 +125,16 @@ TEST_CASE(error_reporting) {
125125
directory_entry ent;
126126

127127
std::error_code ec = GetTestEC();
128-
ent.assign(static_env.DNE, ec);
128+
ent.assign(StaticEnv::DNE, ec);
129129
TEST_CHECK(ec);
130-
TEST_REQUIRE(ent.path() == static_env.DNE);
130+
TEST_REQUIRE(ent.path() == StaticEnv::DNE);
131131
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
132132

133133
ec = GetTestEC();
134134
TEST_CHECK(ent.hard_link_count(ec) == uintmax_t(-1));
135135
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
136136

137-
ExceptionChecker Checker(static_env.DNE,
137+
ExceptionChecker Checker(StaticEnv::DNE,
138138
std::errc::no_such_file_or_directory,
139139
"directory_entry::hard_link_count");
140140
TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.hard_link_count());
@@ -144,20 +144,20 @@ TEST_CASE(error_reporting) {
144144
directory_entry ent;
145145

146146
std::error_code ec = GetTestEC();
147-
uintmax_t expect_bad = hard_link_count(static_env.BadSymlink, ec);
147+
uintmax_t expect_bad = hard_link_count(StaticEnv::BadSymlink, ec);
148148
TEST_CHECK(expect_bad == uintmax_t(-1));
149149
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
150150

151151
ec = GetTestEC();
152-
ent.assign(static_env.BadSymlink, ec);
153-
TEST_REQUIRE(ent.path() == static_env.BadSymlink);
152+
ent.assign(StaticEnv::BadSymlink, ec);
153+
TEST_REQUIRE(ent.path() == StaticEnv::BadSymlink);
154154
TEST_CHECK(!ec);
155155

156156
ec = GetTestEC();
157157
TEST_CHECK(ent.hard_link_count(ec) == expect_bad);
158158
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
159159

160-
ExceptionChecker Checker(static_env.BadSymlink,
160+
ExceptionChecker Checker(StaticEnv::BadSymlink,
161161
std::errc::no_such_file_or_directory,
162162
"directory_entry::hard_link_count");
163163
TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.hard_link_count());

libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// FILE_DEPENDENCIES: ../../Inputs/static_test_env
910
// UNSUPPORTED: c++98, c++03
1011

1112
// <filesystem>
@@ -83,7 +84,6 @@ TEST_CASE(basic) {
8384
TEST_CASE(error_reporting) {
8485
using namespace fs;
8586

86-
static_test_env static_env;
8787
scoped_test_env env;
8888

8989
const path dir = env.create_dir("dir");
@@ -99,15 +99,15 @@ TEST_CASE(error_reporting) {
9999
directory_entry ent;
100100

101101
std::error_code ec = GetTestEC();
102-
ent.assign(static_env.DNE, ec);
103-
TEST_REQUIRE(ent.path() == static_env.DNE);
102+
ent.assign(StaticEnv::DNE, ec);
103+
TEST_REQUIRE(ent.path() == StaticEnv::DNE);
104104
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
105105

106106
ec = GetTestEC();
107107
TEST_CHECK(ent.last_write_time(ec) == file_time_type::min());
108108
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
109109

110-
ExceptionChecker Checker(static_env.DNE,
110+
ExceptionChecker Checker(StaticEnv::DNE,
111111
std::errc::no_such_file_or_directory,
112112
"directory_entry::last_write_time");
113113
TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.last_write_time());
@@ -117,20 +117,20 @@ TEST_CASE(error_reporting) {
117117
directory_entry ent;
118118

119119
std::error_code ec = GetTestEC();
120-
file_time_type expect_bad = last_write_time(static_env.BadSymlink, ec);
120+
file_time_type expect_bad = last_write_time(StaticEnv::BadSymlink, ec);
121121
TEST_CHECK(expect_bad == file_time_type::min());
122122
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
123123

124124
ec = GetTestEC();
125-
ent.assign(static_env.BadSymlink, ec);
126-
TEST_REQUIRE(ent.path() == static_env.BadSymlink);
125+
ent.assign(StaticEnv::BadSymlink, ec);
126+
TEST_REQUIRE(ent.path() == StaticEnv::BadSymlink);
127127
TEST_CHECK(!ec);
128128

129129
ec = GetTestEC();
130130
TEST_CHECK(ent.last_write_time(ec) == expect_bad);
131131
TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
132132

133-
ExceptionChecker Checker(static_env.BadSymlink,
133+
ExceptionChecker Checker(StaticEnv::BadSymlink,
134134
std::errc::no_such_file_or_directory,
135135
"directory_entry::last_write_time");
136136
TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.last_write_time());

libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/status.pass.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ TEST_SUITE(directory_entry_status_testsuite)
2828

2929
TEST_CASE(test_basic) {
3030
using namespace fs;
31-
static_test_env static_env;
3231
{
3332
const fs::directory_entry e("foo");
3433
std::error_code ec;
@@ -37,8 +36,8 @@ TEST_CASE(test_basic) {
3736
static_assert(noexcept(e.status()) == false, "");
3837
static_assert(noexcept(e.status(ec)) == true, "");
3938
}
40-
path TestCases[] = {static_env.File, static_env.Dir, static_env.SymlinkToFile,
41-
static_env.DNE};
39+
path TestCases[] = {StaticEnv::File, StaticEnv::Dir, StaticEnv::SymlinkToFile,
40+
StaticEnv::DNE};
4241
for (const auto& p : TestCases) {
4342
const directory_entry e(p);
4443
std::error_code pec = GetTestEC(), eec = GetTestEC(1);

libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ TEST_SUITE(directory_entry_obs_suite)
2828

2929
TEST_CASE(test_signature) {
3030
using namespace fs;
31-
static_test_env static_env;
3231
{
3332
const directory_entry e("foo");
3433
std::error_code ec;
@@ -37,8 +36,8 @@ TEST_CASE(test_signature) {
3736
static_assert(noexcept(e.symlink_status()) == false, "");
3837
static_assert(noexcept(e.symlink_status(ec)) == true, "");
3938
}
40-
path TestCases[] = {static_env.File, static_env.Dir, static_env.SymlinkToFile,
41-
static_env.DNE};
39+
path TestCases[] = {StaticEnv::File, StaticEnv::Dir, StaticEnv::SymlinkToFile,
40+
StaticEnv::DNE};
4241
for (const auto& p : TestCases) {
4342
const directory_entry e(p);
4443
std::error_code pec = GetTestEC(), eec = GetTestEC(1);

libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// FILE_DEPENDENCIES: ../../Inputs/static_test_env
910
// UNSUPPORTED: c++98, c++03
1011

1112
// <filesystem>
@@ -42,8 +43,7 @@ TEST_CASE(test_copy_end_iterator)
4243

4344
TEST_CASE(test_copy_valid_iterator)
4445
{
45-
static_test_env static_env;
46-
const path testDir = static_env.Dir;
46+
const path testDir = StaticEnv::Dir;
4747
const directory_iterator endIt{};
4848

4949
const directory_iterator it(testDir);

libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// FILE_DEPENDENCIES: ../../Inputs/static_test_env
910
// UNSUPPORTED: c++98, c++03
1011

1112
// <filesystem>
@@ -35,8 +36,7 @@ TEST_CASE(test_assignment_signature)
3536

3637
TEST_CASE(test_copy_to_end_iterator)
3738
{
38-
static_test_env static_env;
39-
const path testDir = static_env.Dir;
39+
const path testDir = StaticEnv::Dir;
4040

4141
const directory_iterator from(testDir);
4242
TEST_REQUIRE(from != directory_iterator{});
@@ -52,8 +52,7 @@ TEST_CASE(test_copy_to_end_iterator)
5252

5353
TEST_CASE(test_copy_from_end_iterator)
5454
{
55-
static_test_env static_env;
56-
const path testDir = static_env.Dir;
55+
const path testDir = StaticEnv::Dir;
5756

5857
const directory_iterator from{};
5958

@@ -67,8 +66,7 @@ TEST_CASE(test_copy_from_end_iterator)
6766

6867
TEST_CASE(test_copy_valid_iterator)
6968
{
70-
static_test_env static_env;
71-
const path testDir = static_env.Dir;
69+
const path testDir = StaticEnv::Dir;
7270
const directory_iterator endIt{};
7371

7472
directory_iterator it_obj(testDir);

0 commit comments

Comments
 (0)