Skip to content

Commit c0079ba

Browse files
[libc] Make utimes_test more stable (#134321)
The test for utimes added in #134167 might fail if the file for one test hasn't been cleaned up by the OS before the second test starts. This patch makes the tests use different files.
1 parent ee1ee11 commit c0079ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libc/test/src/sys/time/utimes_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
#include "test/UnitTest/ErrnoSetterMatcher.h"
1818
#include "test/UnitTest/Test.h"
1919

20-
constexpr const char *FILE_PATH = "utimes.test";
21-
2220
// SUCCESS: Takes a file and successfully updates
2321
// its last access and modified times.
2422
TEST(LlvmLibcUtimesTest, ChangeTimesSpecific) {
2523
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
2624

25+
constexpr const char *FILE_PATH = "utimes_pass.test";
2726
auto TEST_FILE = libc_make_test_file_path(FILE_PATH);
2827
int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT);
2928
ASSERT_GT(fd, 0);
@@ -62,6 +61,7 @@ TEST(LlvmLibcUtimesTest, InvalidMicroseconds) {
6261
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
6362
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
6463

64+
constexpr const char *FILE_PATH = "utimes_fail.test";
6565
auto TEST_FILE = libc_make_test_file_path(FILE_PATH);
6666
int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT);
6767
ASSERT_GT(fd, 0);

0 commit comments

Comments
 (0)