-
Notifications
You must be signed in to change notification settings - Fork 545
/
Snakefile
102 lines (92 loc) · 2.69 KB
/
Snakefile
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
rule all:
input: "minimal_ok.out"
# Setup files for testing of shadow: "minimal"
rule minimal_setup:
input: "test.in"
output:
"subdir1/subdir2/test.in",
"subdir1/subdir2/test.symbolic.in"
shell:
"""
cp -P {input} {output[0]}
cd subdir1/subdir2
ln -s test.in test.symbolic.in
"""
# Tests relative inputs/outputs and in the current dir
rule minimal_rel_curdir:
input: "test.in"
output: protected("simple_minimal.out")
benchmark: "benchmark_minimal.txt"
log: "minimal.log"
shadow: "copy-minimal"
shell:
"""
if [ ! -f "{input}" -o -L "{input}" ]; then
echo "Input file is symbolic link and not a copy"
exit 1
fi
touch minimal_junk.out
cat {input} >> {output}
echo simple_minimal >> {output}
echo minimal_log > {log}
"""
# Tests relative inputs/outputs in subdirectories
rule minimal_rel_subdir:
input: "subdir1/subdir2/test.in"
output: "outdir/minimal.out"
shadow: "copy-minimal"
shell:
"""
if [ ! -f "{input}" -o -L "{input}" ]; then
echo "Input file is symbolic link and not a copy"
exit 1
fi
touch outdir/minimal_junk.out
touch {output}
"""
# Tests symbolic input/output
rule minimal_symbolic:
input: "subdir1/subdir2/test.symbolic.in"
output: "outdir/minimal_real.out",
"outdir/minimal_symbolic.out"
shadow: "copy-minimal"
shell:
"""
if [ ! -f "{input}" -o -L "{input}" ]; then
echo "Input file is symbolic link and not a copy"
exit 1
fi
touch outdir/minimal_real.out
cd outdir
ln -s minimal_real.out minimal_symbolic.out
"""
# Tests absolute input/output
rule minimal_absolute:
input:
os.path.join(os.getcwd(),"test.in")
output: os.path.join(os.getcwd(),"outdir/minimal_absolute.out")
shadow: "copy-minimal"
shell:
"""
if [ ! -f "{input}" -o -L "{input}" ]; then
echo "Input file is symbolic link and not a copy"
exit 1
fi
touch {output}
"""
# Aggregates tests for shadow: "minimal"
rule minimal_ok:
input: "simple_minimal.out",
"outdir/minimal.out",
"outdir/minimal_symbolic.out",
os.path.join(os.getcwd(),"outdir/minimal_absolute.out")
output: "minimal_ok.out"
shell:
"""
#test ! -w {input[0]}
test -f benchmark_minimal.txt
test -f minimal.log
test ! -f minimal_junk.out
test ! -f outdir/minimal_junk.out
touch {output}
"""