Commit a8cf320f authored by Eric Timmons's avatar Eric Timmons
Browse files

Add block and character device tests

parent c11a9e3a
......@@ -25,6 +25,8 @@
#:uid
#:gid
#:linkname
#:devmajor
#:devminor
;; entry tests
#:entry-directory-p
......
No preview for this file type
......@@ -2,29 +2,40 @@
DIR="$(mktemp -d)"
MTIME="Fri Aug 13 09:05:46.75 PM EDT 2021"
touch_file () {
touch -a --date "Fri Aug 13 09:05:46.75 PM EDT 2021" "$1"
touch -a --date "$MTIME" "$1"
}
touch_files () {
touch_file "$DIR/a.txt"
touch_file "$DIR/a-symlink.txt"
touch_file "$DIR/a-hardlink.txt"
sudo touch -a --date "$MTIME" "$DIR/sda1"
sudo touch -a --date "$MTIME" "$DIR/tty0"
}
echo "Hello, world!" > "$DIR/a.txt"
ln -s a.txt "$DIR/a-symlink.txt"
ln "$DIR/a.txt" "$DIR/a-hardlink.txt"
sudo mknod "$DIR/sda1" b 8 1
sudo mknod "$DIR/tty0" c 4 0
run_tar () {
files="a.txt a-symlink.txt a-hardlink.txt"
if [ "$1" != "v7" ]; then
files="$files sda1 tty0"
fi
tar -H "$1" -C "$DIR" \
--group=root --owner=root \
-b 20 \
--mtime "Fri Aug 13 09:05:46.5 PM EDT 2021" \
-cf "$1.tar" a.txt a-symlink.txt a-hardlink.txt
-cf "$1.tar" $files
}
ls -lah "$DIR"
touch_files
run_tar ustar
touch_files
......@@ -34,4 +45,4 @@ run_tar gnu
touch_files
run_tar v7
rm -rf "$DIR"
sudo rm -rf "$DIR"
No preview for this file type
......@@ -49,6 +49,34 @@
(para:is = (tar:gid entry) 0)
(para:is equal (tar:linkname entry) "a.txt")
;; sda1
(setf entry (tar:read-entry-from-archive a))
(para:is equal (tar:name entry) "sda1")
(para:is = (tar:size entry) 0)
(para:is equal (tar:uname entry) "root")
(para:is equal (tar:gname entry) "root")
(para:is = (tar:mode entry) #o644)
(para:true (tar:entry-block-device-p entry))
(para:is = (tar:mtime entry) 1628903146)
(para:is = (tar:uid entry) 0)
(para:is = (tar:gid entry) 0)
(para:is = (tar:devmajor entry) 8)
(para:is = (tar:devminor entry) 1)
;; tty0
(setf entry (tar:read-entry-from-archive a))
(para:is equal (tar:name entry) "tty0")
(para:is = (tar:size entry) 0)
(para:is equal (tar:uname entry) "root")
(para:is equal (tar:gname entry) "root")
(para:is = (tar:mode entry) #o644)
(para:true (tar:entry-character-device-p entry))
(para:is = (tar:mtime entry) 1628903146)
(para:is = (tar:uid entry) 0)
(para:is = (tar:gid entry) 0)
(para:is = (tar:devmajor entry) 4)
(para:is = (tar:devminor entry) 0)
;; End of archive
(setf entry (tar:read-entry-from-archive a))
(para:true (null entry)))))
......
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment