File: test31

package info (click to toggle)
par2cmdline 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,332 kB
  • sloc: cpp: 14,251; sh: 6,293; makefile: 151
file content (113 lines) | stat: -rwxr-xr-x 2,733 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh

execdir="$PWD"

# valgrind tests memory usage.
# wine allow for windows testing on linux
if [ -n "${PARVALGRINDOPTS+set}" ]
then
    PARBINARY="valgrind $PARVALGRINDOPTS $execdir/par2"
elif [ "`which wine`" != "" ] && [ -f "$execdir/par2.exe" ]
then
    PARBINARY="wine $execdir/par2.exe"
else
    PARBINARY="$execdir/par2"
fi


if [ -z "$srcdir" ] || [ "." = "$srcdir" ]; then
  srcdir="$PWD"
  TESTDATA="$srcdir/tests"
else
  srcdir="$PWD/$srcdir"
  TESTDATA="$srcdir/tests"
fi

TESTROOT="$PWD"

testname=$(basename $0)
rm -f "$testname.log"
rm -rf "run$testname"

mkdir "run$testname" && cd "run$testname" || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2

tar -xzf "$TESTDATA/smallsubdirdata.tar.gz" || { echo "ERROR: Could not extract data test files" ; exit 1; } >&2

banner="Bug 150, Files in rootfolder are not used with recursion"
dashes=`echo "$banner" | sed s/./-/g`

echo $dashes
echo $banner
echo $dashes

# before the subdirs
echo "file in rootpath" > aaaa-test.data
# after the subdirs
echo "another file in rootpath" > test-a.data

######
# BEFORE:
#
# $ tree
# .
# ├── aaaa-test.data
# ├── subdir1
# │   └── test-0.data
# ├── subdir2
# │   ├── test-1.data
# │   ├── test-2.data
# │   ├── test-3.data
# │   ├── test-4.data
# │   ├── test-5.data
# │   ├── test-6.data
# │   ├── test-7.data
# │   ├── test-8.data
# │   └── test-9.data
# └── test-a.data
# 
# 3 directories, 12 files
######

$PARBINARY create -R * || { echo "ERROR: Recursive creation of PAR 2.0 files failed" ; exit 1; } >&2

######
# AFTER:
#
# tree 
# .
# ├── aaaa-test.data
# ├── aaaa-test.data.par2
# ├── aaaa-test.data.vol000+01.par2
# ├── aaaa-test.data.vol001+02.par2
# ├── aaaa-test.data.vol003+04.par2
# ├── aaaa-test.data.vol007+08.par2
# ├── aaaa-test.data.vol015+16.par2
# ├── aaaa-test.data.vol031+32.par2
# ├── aaaa-test.data.vol063+37.par2
# ├── subdir1
# │   └── test-0.data
# ├── subdir2
# │   ├── test-1.data
# │   ├── test-2.data
# │   ├── test-3.data
# │   ├── test-4.data
# │   ├── test-5.data
# │   ├── test-6.data
# │   ├── test-7.data
# │   ├── test-8.data
# │   └── test-9.data
# └── test-a.data
# 
# 3 directories, 20 files
######

# The first file in the wildcard expansion is used ad parfilename so not
# covered for repair
rm aaaa-test.data

$PARBINARY verify aaaa-test.data.par2 || { echo "ERROR: verify of rootpath inclusion failed" ; exit 1; } >&2

cd "$TESTROOT"
rm -rf "run$testname"

exit 0