Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
care: Add test for non-regular files + use GNU tar as .bin internal f…
Browse files Browse the repository at this point in the history
…ormat.
  • Loading branch information
cedric-vincent committed Jan 24, 2014
1 parent 2c1ac9d commit 0b338fe
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/extension/care/archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ static void parse_suffix(const Tracee* tracee, Format *format,
if (no_filter_found && no_format_found) {
format->add_filter = archive_write_add_filter_lzop;
format->options = "lzop:compression-level=1";
format->set_format = archive_write_set_format_cpio;
format->hardlink_resolver_strategy = ARCHIVE_FORMAT_CPIO_POSIX;
format->set_format = archive_write_set_format_gnutar;
format->hardlink_resolver_strategy = ARCHIVE_FORMAT_TAR_GNUTAR;
format->self_extracting = true;

if (no_wrapper_found)
Expand Down
39 changes: 34 additions & 5 deletions tests/test-9f5eeb72.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if [ -z `which mkdir` ] || [ -z `which chmod` ] || [ -z `which touch` ] || [ -z `which ln` ] || [ -z `which cpio` ] || [ -z `which stat` ] || [ -z `which cat` ] || [ -z `which readlink` ] || [ -z `which mcookie` ]; then
if [ -z `which mkdir` ] || [ -z `which chmod` ] || [ -z `which touch` ] || [ -z `which ln` ] || [ -z `which cpio` ] || [ -z `which stat` ] || [ -z `which cat` ] || [ -z `which readlink` ] || [ -z `which mcookie` ] || [ -z `which mknod` ]; then
exit 125;
fi

Expand All @@ -19,7 +19,7 @@ chmod -w a
touch ł
ln ł d
ln -s dangling_symlink e

mknod f p
mkdir -p x/y
chmod -rwx x

Expand Down Expand Up @@ -53,7 +53,7 @@ do
${CARE} -o test${FORMAT} cat a/b ł d a/c

if [ -n "${EXTRACT}" ]; then
! chmod +w -R test-${FORMAT}-1
! chmod +rwx -R test-${FORMAT}-1
rm -fr test-${FORMAT}-1
mkdir test-${FORMAT}-1
cd test-${FORMAT}-1
Expand All @@ -76,13 +76,16 @@ do

if [ -n "${EXTRACT}" ]; then
cd ..
else
! chmod +rwx -R test
rm -fr test
fi

# Check: last archived version wins, symlinks
${CARE} -o test${FORMAT} sh -c 'ls a; ls a/b; ls -l e'

if [ -n "${EXTRACT}" ]; then
! chmod +w -R test-${FORMAT}-2
! chmod +rwx -R test-${FORMAT}-2
rm -fr test-${FORMAT}-2
mkdir test-${FORMAT}-2
cd test-${FORMAT}-2
Expand All @@ -101,19 +104,45 @@ do

if [ -n "${EXTRACT}" ]; then
cd ..
else
! chmod +rwx -R test
rm -fr test
fi

# Check: non-regular files are archived/extractable
${CARE} -d -p /dev -p /proc -o test${FORMAT} sh -c 'ls -l f'

if [ -n "${EXTRACT}" ]; then
! chmod +rwx -R test-${FORMAT}-1
rm -fr test-${FORMAT}-1
mkdir test-${FORMAT}-1
cd test-${FORMAT}-1
${EXTRACT} ../test${FORMAT}
fi

[ "fifo" = "$(stat -c %F test/rootfs/${CWD}/f)" ]

if [ -n "${EXTRACT}" ]; then
cd ..
else
! chmod +rwx -R test
rm -fr test
fi

# Check: extractable archive
${CARE} -o test${FORMAT} chmod -R +rwx x

if [ -n "${EXTRACT}" ]; then
! chmod +w -R test-${FORMAT}-3
! chmod +rwx -R test-${FORMAT}-3
rm -fr test-${FORMAT}-3
mkdir test-${FORMAT}-3
cd test-${FORMAT}-3
${EXTRACT} ../test${FORMAT}

cd ..
else
! chmod +rwx -R test
rm -fr test
fi
done

Expand Down

0 comments on commit 0b338fe

Please sign in to comment.