[Git][cmucl/cmucl][issue-449-set-timestamp-on-test-file] Address review comments
Raymond Toy pushed to branch issue-449-set-timestamp-on-test-file at cmucl / cmucl Commits: 3732db6e by Raymond Toy at 2025-10-23T08:15:34-07:00 Address review comments Add test for timestamp in 2106 that won't fit in a 32-bit int. To do this, we added a new file 64-bit-timestamp-2106.txt and renamed 64-bit-timestamp.txt to 64-bit-timestamp-2038.txt. Update run-unit-tests.sh to set the time stamps on these two files, and add a test to os.lisp for the new file. Finally, a minor tweak to os.lisp because we got the expected and actual values backwards in `assert-equal` for the time stamp tests. The expected value is first. - - - - - 4 changed files: - bin/run-unit-tests.sh - tests/os.lisp - tests/resources/64-bit-timestamp.txt → tests/resources/64-bit-timestamp-2038.txt - + tests/resources/64-bit-timestamp-2106.txt Changes: ===================================== bin/run-unit-tests.sh ===================================== @@ -42,10 +42,13 @@ rm -rf test-tmp mkdir test-tmp ln -s /bin/ls test-tmp/ls-link -# Set the timestamp on 64-bit-timestamp.txt. It's ok if this doesn't -# work in general, as long as it works on Linux for the stat test in -# tests/os.lisp. -touch -d "1 April 2038" tests/resources/64-bit-timestamp.txt +# Set the timestamps on 64-bit-timestamp-2038.txt and +# 64-bit-timestamp-2106.txt. The time for the first file is a +# negative value for a 32-bit time_t. The second file won't fit in a +# 32-bit time_t value. It's ok if this doesn't work in general, as +# long as it works on Linux for the stat test in tests/os.lisp. +touch -d "1 April 2038" tests/resources/64-bit-timestamp-2038.txt +touch -d "1 April 2106" tests/resources/64-bit-timestamp-2106.txt # Cleanup temp files and directories that we created during testing. function cleanup { ===================================== tests/os.lisp ===================================== @@ -36,9 +36,24 @@ (assert-eql status 0))) #+linux -(define-test stat.64-bit-timestamp +(define-test stat.64-bit-timestamp-2038 (:tag :issues) - (let ((test-file #.(merge-pathnames "resources/64-bit-timestamp.txt" + (let ((test-file #.(merge-pathnames "resources/64-bit-timestamp-2038.txt" + cl:*load-pathname*))) + (assert-true (probe-file test-file)) + (multiple-value-bind (ok st-dev st-ino st-mode st-nlink st-uid st-gid st-rdev st-size + st-atime st-mtime + st-ctime st-blksize st-blocks) + (unix:unix-stat (namestring test-file)) + (declare (ignore st-dev st-ino st-mode st-nlink st-uid st-gid st-rdev st-size + st-ctime st-blksize st-blocks)) + (assert-true ok) + (assert-equal 2153718000 st-atime) + (assert-equal 2153718000 st-mtime)))) + +(define-test stat.64-bit-timestamp-2106 + (:tag :issues) + (let ((test-file #.(merge-pathnames "resources/64-bit-timestamp-2106.txt" cl:*load-pathname*))) (assert-true (probe-file test-file)) (multiple-value-bind (ok st-dev st-ino st-mode st-nlink st-uid st-gid st-rdev st-size @@ -48,5 +63,5 @@ (declare (ignore st-dev st-ino st-mode st-nlink st-uid st-gid st-rdev st-ctime st-blksize st-blocks)) (assert-true ok) - (assert-equal st-atime 2153718000) - (assert-equal st-mtime 2153718000)))) + (assert-equal 4299548400 st-atime) + (assert-equal 4299548400 st-mtime)))) ===================================== tests/resources/64-bit-timestamp.txt → tests/resources/64-bit-timestamp-2038.txt ===================================== ===================================== tests/resources/64-bit-timestamp-2106.txt ===================================== View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/3732db6efc15ee53fd88065c... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/3732db6efc15ee53fd88065c... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)