summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-07-06 14:14:10 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-07-06 14:14:52 +0000
commit76f534936699eda59af840b2c297f689f0392954 (patch)
tree9a6efc7c99f169bea8ed479ecf1daad8a9e5468a /tests
parent7eb79318200a98acfcc03368c75172332a524797 (diff)
downloadmorph-76f534936699eda59af840b2c297f689f0392954.tar.gz
tests: make build-chunk-writes-log simpler
Process substitution is a little funky and bash variable substitution's suffix stripping is hard to remember. Instead write the list of sources to a temporary file and redirect that to the while loop.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/build-chunk-writes-log.script13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/build-chunk-writes-log.script b/tests/build-chunk-writes-log.script
index 5b4d90b0..6b44d3cd 100755
--- a/tests/build-chunk-writes-log.script
+++ b/tests/build-chunk-writes-log.script
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Test building a chunk.
#
@@ -21,15 +21,16 @@ set -eu
"$SRCDIR/scripts/test-morph" build test:chunk-repo farrokh hello.morph
+SOURCES="$DATADIR/cached-sources"
+find "$DATADIR/cache/artifacts" -name '*.chunk.*' |
+ sed 's|\.chunk\..*||' | sort -u >"$SOURCES"
+
found=false
# list of sources in cache is not piped because while loop changes variable
while read source; do
[ -e "$source".build-log ] || continue
found=true
break
-done < <(
- for chunk in "$DATADIR/cache/artifacts/"*.chunk.*
- do
- echo "${chunk%%.chunk.*}"
- done | sort -u)
+done <"$SOURCES"
"$found"
+