From a4d0d4ee4b4ffb044211791bd843a16f82f31a8b Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 8 Feb 2024 20:47:29 +0200 Subject: [PATCH] os: make os_stat_test.v more robust to reporting false positives --- vlib/os/os_stat_test.v | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vlib/os/os_stat_test.v b/vlib/os/os_stat_test.v index 37d42bf410b88e..20934a9bcddd6e 100644 --- a/vlib/os/os_stat_test.v +++ b/vlib/os/os_stat_test.v @@ -3,7 +3,7 @@ import rand import time fn test_stat() { - start_time := time.utc() + start_time := time.utc().add(-2 * time.second) temp_dir := os.join_path(os.temp_dir(), rand.ulid()) os.mkdir(temp_dir)! @@ -21,6 +21,8 @@ fn test_stat() { end_time := time.utc() mut fstat := os.stat(test_file)! + eprintln(@LOCATION) + eprintln(' | start_time: ${start_time.unix}\n | end_time: ${end_time.unix}\n | fstat.ctime: ${fstat.ctime}\n | fstat.mtime: ${fstat.mtime}') assert fstat.get_filetype() == .regular assert fstat.size == u64(test_content.len) assert fstat.ctime >= start_time.unix