| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
import subprocess |
| 9 |
|
| 10 |
from rsyncfns import SRCDIR, TOOLDIR, test_fail |
| 11 |
|
| 12 |
|
| 13 |
OPTION_SETS = [ |
| 14 |
[], |
| 15 |
['-x1'], |
| 16 |
['-x1', '-e1'], |
| 17 |
['-x1', '-e1se'], |
| 18 |
['-x2'], |
| 19 |
['-x2', '-ese'], |
| 20 |
['-x3'], |
| 21 |
['-x3', '-e1'], |
| 22 |
['-x4'], |
| 23 |
['-x4', '-e2e'], |
| 24 |
['-x5'], |
| 25 |
['-x5', '-es'], |
| 26 |
] |
| 27 |
|
| 28 |
EXPECTED = "No wildmatch errors found.\n" |
| 29 |
|
| 30 |
wildtest = str(TOOLDIR / 'wildtest') |
| 31 |
wildtest_txt = str(SRCDIR / 'wildtest.txt') |
| 32 |
|
| 33 |
for opts in OPTION_SETS: |
| 34 |
print(f"Running wildtest with {' '.join(opts)}") |
| 35 |
proc = subprocess.run( |
| 36 |
[wildtest, *opts, wildtest_txt], |
| 37 |
capture_output=True, text=True, |
| 38 |
) |
| 39 |
if proc.returncode != 0: |
| 40 |
test_fail( |
| 41 |
f"wildtest {' '.join(opts)} exited {proc.returncode}\n" |
| 42 |
f"stderr:\n{proc.stderr}\nstdout:\n{proc.stdout}" |
| 43 |
) |
| 44 |
if proc.stdout != EXPECTED: |
| 45 |
test_fail( |
| 46 |
f"wildtest {' '.join(opts)} output did not match expected.\n" |
| 47 |
f"--- expected ---\n{EXPECTED}" |
| 48 |
f"--- got ---\n{proc.stdout}" |
| 49 |
) |