Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
cl-tar
cl-tar-file
Commits
c11a9e3a
Commit
c11a9e3a
authored
Aug 15, 2021
by
Eric Timmons
Browse files
Add tests for hard and sym links
parent
7278e83e
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/entry.lisp
View file @
c11a9e3a
...
...
@@ -116,6 +116,9 @@
(
defmethod
entry-symbolic-link-p
(
entry
)
(
eql
(
typeflag
entry
)
+tar-symbolic-link+
))
(
defmethod
entry-hard-link-p
(
entry
)
(
eql
(
typeflag
entry
)
+tar-hard-link+
))
(
defmethod
entry-character-device-p
(
entry
)
(
eql
(
typeflag
entry
)
+tar-character-device+
))
...
...
src/package.lisp
View file @
c11a9e3a
...
...
@@ -24,10 +24,13 @@
#:mtime
#:uid
#:gid
#:linkname
;; entry tests
#:entry-directory-p
#:entry-regular-file-p
#:entry-symbolic-link-p
#:entry-hard-link-p
#:entry-character-device-p
#:entry-block-device-p
#:entry-fifo-p
...
...
test/gnu.tar
View file @
c11a9e3a
No preview for this file type
test/make-test-tars.sh
View file @
c11a9e3a
...
...
@@ -8,18 +8,23 @@ touch_file () {
touch_files
()
{
touch_file
"
$DIR
/a.txt"
touch_file
"
$DIR
/a-symlink.txt"
touch_file
"
$DIR
/a-hardlink.txt"
}
echo
"Hello, world!"
>
"
$DIR
/a.txt"
ln
-s
a.txt
"
$DIR
/a-symlink.txt"
ln
"
$DIR
/a.txt"
"
$DIR
/a-hardlink.txt"
run_tar
()
{
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
-cf
"
$1
.tar"
a.txt
a-symlink.txt a-hardlink.txt
}
ls
-lah
"
$DIR
"
touch_files
run_tar ustar
touch_files
...
...
test/pax.tar
View file @
c11a9e3a
No preview for this file type
test/tar.lisp
View file @
c11a9e3a
...
...
@@ -11,6 +11,7 @@
(
let
(
entry
)
;; First entry is a plain file, with the contents "Hello, world!"
(
setf
entry
(
tar:read-entry-from-archive
a
))
(
para:is
equal
(
tar:name
entry
)
"a.txt"
)
(
para:is
=
(
tar:size
entry
)
14
)
(
para:is
equal
(
tar:uname
entry
)
"root"
)
(
para:is
equal
(
tar:gname
entry
)
"root"
)
...
...
@@ -22,6 +23,32 @@
(
para:is
equal
"Hello, world!
"
(
contents-as-string
entry
))
;; Next is the a-symlink.txt -> a.txt symlink
(
setf
entry
(
tar:read-entry-from-archive
a
))
(
para:is
equal
(
tar:name
entry
)
"a-symlink.txt"
)
(
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
)
#o777
)
(
para:true
(
tar:entry-symbolic-link-p
entry
))
(
para:is
=
(
tar:mtime
entry
)
1628903146
)
(
para:is
=
(
tar:uid
entry
)
0
)
(
para:is
=
(
tar:gid
entry
)
0
)
(
para:is
equal
(
tar:linkname
entry
)
"a.txt"
)
;; Next is the a-hardlink.txt -> a.txt hardlink
(
setf
entry
(
tar:read-entry-from-archive
a
))
(
para:is
equal
(
tar:name
entry
)
"a-hardlink.txt"
)
(
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-hard-link-p
entry
))
(
para:is
=
(
tar:mtime
entry
)
1628903146
)
(
para:is
=
(
tar:uid
entry
)
0
)
(
para:is
=
(
tar:gid
entry
)
0
)
(
para:is
equal
(
tar:linkname
entry
)
"a.txt"
)
;; End of archive
(
setf
entry
(
tar:read-entry-from-archive
a
))
(
para:true
(
null
entry
)))))
...
...
@@ -41,6 +68,28 @@
(
para:is
equal
"Hello, world!
"
(
contents-as-string
entry
))
;; Next is the a-symlink.txt -> a.txt symlink
(
setf
entry
(
tar:read-entry-from-archive
a
))
(
para:is
equal
(
tar:name
entry
)
"a-symlink.txt"
)
(
para:is
=
(
tar:size
entry
)
0
)
(
para:is
=
(
tar:mode
entry
)
#o777
)
(
para:true
(
tar:entry-symbolic-link-p
entry
))
(
para:is
=
(
tar:mtime
entry
)
1628903146
)
(
para:is
=
(
tar:uid
entry
)
0
)
(
para:is
=
(
tar:gid
entry
)
0
)
(
para:is
equal
(
tar:linkname
entry
)
"a.txt"
)
;; Next is the a-hardlink.txt -> a.txt hardlink
(
setf
entry
(
tar:read-entry-from-archive
a
))
(
para:is
equal
(
tar:name
entry
)
"a-hardlink.txt"
)
(
para:is
=
(
tar:size
entry
)
0
)
(
para:is
=
(
tar:mode
entry
)
#o644
)
(
para:true
(
tar:entry-hard-link-p
entry
))
(
para:is
=
(
tar:mtime
entry
)
1628903146
)
(
para:is
=
(
tar:uid
entry
)
0
)
(
para:is
=
(
tar:gid
entry
)
0
)
(
para:is
equal
(
tar:linkname
entry
)
"a.txt"
)
;; End of archive
(
setf
entry
(
tar:read-entry-from-archive
a
))
(
para:true
(
null
entry
)))))
test/ustar.tar
View file @
c11a9e3a
No preview for this file type
test/v7.tar
View file @
c11a9e3a
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment