Implement the "wait" checkpoint action.

This action instructs tar to pause until given signal is delivered.
The newer genfile tool uses this action for communication between
genfile and tar in exec mode. This eliminates race conitions and
speeds up the tests based on exec mode.

* doc/tar.texi: Document changes.
* paxutils: Upgrade.
* src/checkpoint.c: Implement the wait action.
* src/common.h (decode_signal): New proto.
* src/tar.c (decode_signal): New function.
(set_stat_signal): Rewrite.
* tests/dirrem01.at: Adjust genfile and tar command line arguments
to use the new feature.
* tests/dirrem02.at: Likewise.
* tests/filerem01.at: Likewise.
* tests/filerem02.at: Likewise.
* tests/grow.at: Likewise.
* tests/sptrcreat.at: Likewise.
* tests/sptrdiff00.at: Likewise.
* tests/sptrdiff01.at: Likewise.
* tests/truncate.at: Likewise.
This commit is contained in:
Sergey Poznyakoff
2018-12-28 13:17:44 +02:00
parent c15c42ccd1
commit e7cd377f78
14 changed files with 111 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright 2017 Free Software Foundation, Inc.
# Copyright 2017-2018 Free Software Foundation, Inc.
# This file is part of GNU tar.
@@ -47,8 +47,7 @@ gnu) CPT=3;;
esac
genfile --run --checkpoint=$CPT --unlink dir/sub/file2 --unlink dir/sub -- \
tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='echo' \
--checkpoint-action='sleep=1' -c -f archive.tar \
tar --blocking-factor=1 -c -f archive.tar \
--listed-incremental db -v dir >/dev/null
],
[1],

View File

@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright 2017 Free Software Foundation, Inc.
# Copyright 2017-2018 Free Software Foundation, Inc.
# This file is part of GNU tar.
@@ -44,8 +44,7 @@ gnu) CPT=3;;
esac
genfile --run --checkpoint=$CPT --unlink dir/sub/file2 --unlink dir/sub -- \
tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='echo' \
--checkpoint-action='sleep=1' -c -f archive.tar \
tar --blocking-factor=1 -c -f archive.tar \
--listed-incremental db -v dir dir/sub >/dev/null
],
[2],

View File

@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright 2009, 2013-2014, 2016-2017 Free Software Foundation, Inc.
# Copyright 2009, 2013-2014, 2016-2018 Free Software Foundation, Inc.
# This file is part of GNU tar.
@@ -33,7 +33,7 @@
# http://lists.gnu.org/archive/html/bug-tar/2009-03/msg00000.html
#
AT_SETUP([file removed as we read it (ca. 22 seconds)])
AT_SETUP([file removed as we read it])
AT_KEYWORDS([create incremental listed filechange filerem filerem01])
AT_TAR_CHECK([
@@ -43,8 +43,7 @@ genfile --file dir/file1
genfile --file dir/sub/file2
genfile --run --checkpoint=3 --unlink dir/file1 -- \
tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='sleep=1' \
--checkpoint-action='echo' -c -f archive.tar \
tar --blocking-factor=1 -c -f archive.tar \
--listed-incremental db -v dir >/dev/null
],
[1],

View File

@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright 2009, 2013-2014, 2016-2017 Free Software Foundation, Inc.
# Copyright 2009, 2013-2014, 2016-2018 Free Software Foundation, Inc.
# This file is part of GNU tar.
@@ -23,7 +23,7 @@
# file or directory disappears that is explicitly mentioned
# in the command line.
AT_SETUP([toplevel file removed (ca. 24 seconds)])
AT_SETUP([toplevel file removed])
AT_KEYWORDS([create incremental listed filechange filerem filerem02])
AT_TAR_CHECK([
@@ -35,8 +35,7 @@ mkdir dir2
genfile --file dir2/file1
genfile --run --checkpoint=3 --exec 'rm -rf dir2' -- \
tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='sleep=1' \
--checkpoint-action='echo' -c -f archive.tar \
tar --blocking-factor=1 -c -f archive.tar \
--listed-incremental db -v --warning=no-new-dir dir dir2 >/dev/null
],
[2],

View File

@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright 2006-2007, 2013-2014, 2016-2017 Free Software Foundation,
# Copyright 2006-2007, 2013-2014, 2016-2018 Free Software Foundation,
# Inc.
# This file is part of GNU tar.
@@ -28,7 +28,7 @@ AT_KEYWORDS([grow filechange])
AT_TAR_CHECK([
genfile --file foo --length 50000k
genfile --file baz
genfile --run --checkpoint 10 --length 1024 --append foo -- tar --checkpoint -vcf bar foo baz
genfile --run=10 --checkpoint 10 --length 1024 --append foo -- tar -vcf bar foo baz
],
[1],
[foo

View File

@@ -38,21 +38,17 @@ genfile --sparse --block-size=1024 --file foo \
0 ABCDEFGHIJ 1M ABCDEFGHIJ 10M ABCDEFGHIJ 200M ABCDEFGHIJ
genfile --file baz
genfile --run --checkpoint 3 --length 200m --truncate foo -- \
tar --checkpoint=1 \
--checkpoint-action=echo \
--checkpoint-action=sleep=1 \
--sparse -vcf bar foo baz
tar --sparse -vcf bar foo baz
echo Exit status: $?
echo separator
genfile --file foo --seek 200m --length 11575296 --pattern=zeros
tar dvf bar],
[1],
tar dvf bar | sed '/foo: Mod time differs/d'],
[0],
[foo
baz
Exit status: 1
separator
foo
foo: Mod time differs
baz
],
[tar: foo: File shrank by 11575296 bytes; padding with zeros

View File

@@ -35,10 +35,7 @@ echo creating
tar --sparse -vcf bar foo baz
echo comparing
genfile --run --checkpoint 3 --length 200m --truncate foo -- \
tar --checkpoint=1 \
--checkpoint-action=echo='Write checkpoint %u' \
--checkpoint-action=sleep=1 \
--sparse -vdf bar
tar --sparse -vdf bar
],
[1],
[creating

View File

@@ -35,10 +35,7 @@ echo creating
tar --sparse -vcf bar foo baz
echo comparing
genfile --run --checkpoint 5 --length 221278210 --truncate foo -- \
tar --checkpoint=1 \
--checkpoint-action=echo='Write checkpoint %u' \
--checkpoint-action=sleep=1 \
--sparse -vdf bar
tar --sparse -vdf bar
],
[1],
[creating

View File

@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright 2005, 2007, 2013-2014, 2016-2017 Free Software Foundation,
# Copyright 2005, 2007, 2013-2014, 2016-2018 Free Software Foundation,
# Inc.
# This file is part of GNU tar.
@@ -33,18 +33,18 @@ AT_KEYWORDS([truncate filechange])
AT_TAR_CHECK([
genfile --file foo --length 200k
genfile --file baz
genfile --run --checkpoint 10 --length 195k --truncate foo -- tar --checkpoint --checkpoint-action=echo --checkpoint-action=sleep=1 -vcf bar foo baz
genfile --run --checkpoint 10 --length 195k --truncate foo -- \
tar -vcf bar foo baz
echo Exit status: $?
echo separator
genfile --file foo --seek 195k --length 5k --pattern=zeros
tar dvf bar],
[1],
tar dvf bar|sed '/foo: Mod time differs/d'],
[0],
[foo
baz
Exit status: 1
separator
foo
foo: Mod time differs
baz
],
[tar: foo: File shrank by 5120 bytes; padding with zeros