]> Cypherpunks.ru repositories - goredo.git/blobdiff - t/redo-sh.tests/parallel_1/test
Import tests from apenwarr/redo and redo.sh
[goredo.git] / t / redo-sh.tests / parallel_1 / test
diff --git a/t/redo-sh.tests/parallel_1/test b/t/redo-sh.tests/parallel_1/test
new file mode 100755 (executable)
index 0000000..254b717
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh -eu
+# Targets must be built in parallel if ā€œ-jā€ option is given.
+
+targets="a b c d e f g h "
+num_targets=$(( ${#targets} / 2 ))
+
+>all.do cat <<EOF
+redo-ifchange ${targets}
+EOF
+
+>default.do cat <<EOF
+redo-always
+sleep 1
+EOF
+
+for jobs in 4 8; do
+ timestamp_before=$(date +%s)
+ redo -j "${jobs}"
+ timestamp_after=$(date +%s)
+
+ duration_observed=$(( ${timestamp_after} - ${timestamp_before} ))
+ duration_expected=$(( ${num_targets} / ${jobs} + 1 ))
+
+ test ${duration_observed} -le ${duration_expected}
+done