summaryrefslogtreecommitdiffstats
path: root/usr.bin/cpio/test/test_option_m.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/cpio/test/test_option_m.c')
-rw-r--r--usr.bin/cpio/test/test_option_m.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/usr.bin/cpio/test/test_option_m.c b/usr.bin/cpio/test/test_option_m.c
index 7f8e901..de880b2 100644
--- a/usr.bin/cpio/test/test_option_m.c
+++ b/usr.bin/cpio/test/test_option_m.c
@@ -28,9 +28,7 @@ __FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_m)
{
- struct stat st;
int r;
- time_t now;
/*
* The reference archive has one file with an mtime in 1970, 1
@@ -38,33 +36,28 @@ DEFINE_TEST(test_option_m)
*/
/* Restored without -m, the result should have a current mtime. */
- assertEqualInt(0, mkdir("without-m", 0755));
- assertEqualInt(0, chdir("without-m"));
+ assertMakeDir("without-m", 0755);
+ assertChdir("without-m");
extract_reference_file("test_option_m.cpio");
- r = systemf("%s -i < test_option_m.cpio >out 2>err", testprog);
- now = time(NULL);
+ r = systemf("%s --no-preserve-owner -i < test_option_m.cpio >out 2>err", testprog);
assertEqualInt(r, 0);
assertEmptyFile("out");
assertTextFileContents("1 block\n", "err");
- assertEqualInt(0, stat("file", &st));
/* Should have been created within the last few seconds. */
- assert(st.st_mtime <= now);
- assert(st.st_mtime > now - 5);
+ assertFileMtimeRecent("file");
/* With -m, it should have an mtime in 1970. */
- assertEqualInt(0, chdir(".."));
- assertEqualInt(0, mkdir("with-m", 0755));
- assertEqualInt(0, chdir("with-m"));
+ assertChdir("..");
+ assertMakeDir("with-m", 0755);
+ assertChdir("with-m");
extract_reference_file("test_option_m.cpio");
- r = systemf("%s -im < test_option_m.cpio >out 2>err", testprog);
- now = time(NULL);
+ r = systemf("%s --no-preserve-owner -im < test_option_m.cpio >out 2>err", testprog);
assertEqualInt(r, 0);
assertEmptyFile("out");
assertTextFileContents("1 block\n", "err");
- assertEqualInt(0, stat("file", &st));
/*
* mtime in reference archive is '1' == 1 second after
* midnight Jan 1, 1970 UTC.
*/
- assertEqualInt(1, st.st_mtime);
+ assertFileMtime("file", 1, 0);
}
OpenPOWER on IntegriCloud