xfstests: btrfs 308: regression test for btrfs send V2
PATCH 1/1 xfstests: btrfs 308: regression test for btrfs send V2
I'm not sure how the numbering is supposed to work now that we've split everything out so I'm just going with the next number in the directory. This is a regression test for btrfs send, we had a problem where we'd try to send a file that had been deleted in the source snapshot. This is just to make sure we don't have the same problem in the future. Thanks,
---V1->V2:
-added a -x optoin to multi_open_unlink to make it not check for existing
files
-made all the normal output go to $seqres.full
src/multi_open_unlink.c | 12 +++++-- tests/btrfs/308 | 75 +++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/308.out | 2 + tests/btrfs/group | 1 + 4 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 tests/btrfs/308 create mode 100644 tests/btrfs/308.out
src/multi_open_unlink.c +8 -4
@@ -39,7 +39,7 @@void usage (char *prog) { -fprintf (stderr,"Usage: %s [-e num-eas] [-f path_prefix] [-n num_files] [-s sleep_time] [-v ea-valuesize] \n" , prog); +fprintf (stderr,"Usage: %s [-e num-eas] [-f path_prefix] [-n num_files] [-s sleep_time] [-v ea-valuesize] [-x] \n" , prog);exit (1 ); }
@@ -54,9 +54,10 @@ main(int argc, char *argv[])int num_eas =0 ;int value_size =ATTR_MAX_VALUELEN ;int fd =-1 ; +int open_flags =O_RDWR |O_CREAT |O_EXCL ;int i,j,c; -while ((c =getopt (argc, argv,"e:f:n:s:v:" )) !=EOF ) { +while ((c =getopt (argc, argv,"e:f:n:s:v:x" )) !=EOF ) {switch (c) {case 'e' :/* create eas */ num_eas =atoi (optarg);
@@ -73,6 +74,9 @@ main(int argc, char *argv[])case 'v' :/* value size on eas */ value_size =atoi (optarg);break ; +case 'x' :/* don't use O_EXCL, for use with exsint files */ + open_flags &= ~O_EXCL ; +break ;case '?' :usage (prog); }
@@ -83,12 +87,12 @@ main(int argc, char *argv[])sprintf (path,"%s.%d" , given_path, i+1 );/* if file already exists then error out */ -if (access (path,F_OK ) ==0 ) { +if ((open_flags &O_EXCL ) &&access (path,F_OK ) ==0 ) {fprintf (stderr,"%s: file \"%s\" already exists\n" , prog, path);return 1 ; } - fd =open (path,O_RDWR |O_CREAT |O_EXCL ,0666 ); + fd =open (path, open_flags,0666 );if (fd ==-1 ) {fprintf (stderr,"%s: failed to create \"%s\": %s\n" , prog, path,strerror (errno));return 1 ;
tests/btrfs/308 new file +75 -0
75 lines not on this page · raw message
tests/btrfs/308.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 308 +Silence is golden
tests/btrfs/group +1 -0
@@ -9,3 +9,4 @@ 276 auto rw metadata 284 auto 307 auto quick +308 auto quick
Signature · 6 lines
1.7.7.6 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 2 lines · Josef Bacik
I'm not sure how the numbering is supposed to work now that we've split everything out so I'm just going with the next number in the directory.
Number them however you want - numbers are unique within a subdirectory.
Quoted 11 lines
This is
a regression test for btrfs send, we had a problem where we'd try to send a file that had been deleted in the source snapshot. This is just to make sure we don't have the same problem in the future. Thanks,Signed-off-by Josef Bacik <[email protected]>---
V1->V2:(quoted diff) +0
-2-added a -x optoin to multi_open_unlink to make it not check for existing files -made all the normal output go to $seqres.full
....
src/multi_open_unlink.c main(int argc, char *argv[]) · line 77
Quoted 5 lines
src/multi_open_unlink.c +1
-0@@ -73,6 +74,9 @@ main(int argc, char *argv[])case 'v' :/* value size on eas */ value_size =atoi (optarg);break ; +case 'x' :/* don't use O_EXCL, for use with exsint files */
Typo - "exsint"
.....
tests/btrfs/308 line 50
Quoted 13 lines
tests/btrfs/308 new file +13
-0+trap "_cleanup ; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch + +_scratch_mkfs > /dev/null 2>&1 +_scratch_mount
You probably want to remove $seqres.full here, so that on failure only the output of the current run is in the file.
Other than those two minor things, it looks good.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs