mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
fsstress: add the -c option
This option causes fsstress to delete the test directory between each run. This is the opposite from the ltp version of fsstress, which deletes the test directory by default, and the -c option caused ltp's fsstress _not_ to delete the test directory. It can be useful to be able to have the same test behavior as ltp version, and although reversing the sense of the option is unfortunate, it also reserves the -c option, which makes it a bit easier if we want to eventually have one version which is a superset of the xfstest and ltp version of fsstress. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
cf67ba1e32
commit
ad75f28690
+12
-2
@@ -258,6 +258,7 @@ int procid;
|
|||||||
int rtpct;
|
int rtpct;
|
||||||
unsigned long seed = 0;
|
unsigned long seed = 0;
|
||||||
ino_t top_ino;
|
ino_t top_ino;
|
||||||
|
int cleanup = 0;
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int verifiable_log = 0;
|
int verifiable_log = 0;
|
||||||
sig_atomic_t should_stop = 0;
|
sig_atomic_t should_stop = 0;
|
||||||
@@ -331,7 +332,7 @@ int main(int argc, char **argv)
|
|||||||
xfs_error_injection_t err_inj;
|
xfs_error_injection_t err_inj;
|
||||||
struct sigaction action;
|
struct sigaction action;
|
||||||
int loops = 1;
|
int loops = 1;
|
||||||
const char *allopts = "d:e:f:i:l:m:M:n:o:p:rs:S:vVwx:X:zH";
|
const char *allopts = "cd:e:f:i:l:m:M:n:o:p:rs:S:vVwx:X:zH";
|
||||||
|
|
||||||
errrange = errtag = 0;
|
errrange = errtag = 0;
|
||||||
umask(0);
|
umask(0);
|
||||||
@@ -340,6 +341,9 @@ int main(int argc, char **argv)
|
|||||||
myprog = argv[0];
|
myprog = argv[0];
|
||||||
while ((c = getopt(argc, argv, allopts)) != -1) {
|
while ((c = getopt(argc, argv, allopts)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case 'c':
|
||||||
|
cleanup = 1;
|
||||||
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
dirname = optarg;
|
dirname = optarg;
|
||||||
break;
|
break;
|
||||||
@@ -862,6 +866,7 @@ doproc(void)
|
|||||||
{
|
{
|
||||||
struct stat64 statbuf;
|
struct stat64 statbuf;
|
||||||
char buf[10];
|
char buf[10];
|
||||||
|
char cmd[64];
|
||||||
int opno;
|
int opno;
|
||||||
int rval;
|
int rval;
|
||||||
opdesc_t *p;
|
opdesc_t *p;
|
||||||
@@ -907,6 +912,10 @@ doproc(void)
|
|||||||
}
|
}
|
||||||
errout:
|
errout:
|
||||||
chdir("..");
|
chdir("..");
|
||||||
|
if (cleanup) {
|
||||||
|
sprintf(cmd, "rm -rf %s", buf);
|
||||||
|
system(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1579,10 +1588,11 @@ void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
printf("Usage: %s -H or\n", myprog);
|
printf("Usage: %s -H or\n", myprog);
|
||||||
printf(" %s [-d dir][-e errtg][-f op_name=freq][-l loops][-n nops]\n",
|
printf(" %s [-c][-d dir][-e errtg][-f op_name=freq][-l loops][-n nops]\n",
|
||||||
myprog);
|
myprog);
|
||||||
printf(" [-p nproc][-r len][-s seed][-v][-w][-x cmd][-z][-S][-X ncmd]\n");
|
printf(" [-p nproc][-r len][-s seed][-v][-w][-x cmd][-z][-S][-X ncmd]\n");
|
||||||
printf("where\n");
|
printf("where\n");
|
||||||
|
printf(" -c clean up the test directory after each run\n");
|
||||||
printf(" -d dir specifies the base directory for operations\n");
|
printf(" -d dir specifies the base directory for operations\n");
|
||||||
printf(" -e errtg specifies error injection stuff\n");
|
printf(" -e errtg specifies error injection stuff\n");
|
||||||
printf(" -f op_name=freq changes the frequency of option name to freq\n");
|
printf(" -f op_name=freq changes the frequency of option name to freq\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user