Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat: Add
shadow: "copy-minimal"
directive (#1155)
* Implement and test `shadow: "copy-minimal"` directive. "copy-minimal" is similar to "minimal", but it creates copies instead of symlinks of the files. This makes it possible to use local hard disks of a node in a cluster. See #1152 for motivation and further explanation. Closes #1152 * Document the `shadow: "copy-minimal"` directive. * Fix formatting. * Test files are ignored for some reason.
- Loading branch information
Showing
8 changed files
with
180 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
in | ||
simple_minimal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters