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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
;; execute this to check the behavior when background jobs take time to finish:
;;
;; $ ./_build/default/bin/main.exe build @test/fail-with-background-jobs-running
;;
(rule
(alias sleep5)
(action
(system "sleep 5")))
(rule
(alias sleep1-and-fail)
(action
(system "sleep 1; exit 1")))
(rule
(alias sleep4-and-fail)
(action
(system "sleep 4; exit 1")))
(alias
(name fail-with-background-jobs-running)
(deps
(alias sleep5)
(alias sleep4-and-fail)
(alias sleep1-and-fail)))
;; execute this to test locks
;;
;; $ ./_build/default/bin/main.exe build -j10 @test/locks
;;
(rule
(alias locks)
(deps
(glob_files *.{foo,bar}))
(action
(bash
"echo 'expected result: 10'\necho 'without locking:' $(< x)\necho 'with locking: ' $(< y)\nrm -f *.{foo,bar} x y")))
(rule
(with-stdout-to
incr.ml
(echo
"let fn = Sys.argv.(1) in\nlet x =\n match open_in fn with\n | ic ->\n let x = int_of_string (input_line ic) in\n close_in ic;\n x\n | exception _ -> 0\nin\nUnix.sleepf 0.2;\nPrintf.fprintf (open_out fn) \"%d\\n\" (x + 1);\nPrintf.fprintf (open_out Sys.argv.(2)) \"%g\n%!\" (Sys.time ())\n")))
(executable
(name incr)
(libraries unix))
(rule
(targets 01.foo)
(action
(run ./incr.exe x %{targets})))
(rule
(targets 02.foo)
(action
(run ./incr.exe x %{targets})))
(rule
(targets 03.foo)
(action
(run ./incr.exe x %{targets})))
(rule
(targets 04.foo)
(action
(run ./incr.exe x %{targets})))
(rule
(targets 05.foo)
(action
(run ./incr.exe x %{targets})))
(rule
(targets 06.foo)
(action
(run ./incr.exe x %{targets})))
(rule
(targets 07.foo)
(action
(run ./incr.exe x %{targets})))
(rule
(targets 08.foo)
(action
(run ./incr.exe x %{targets})))
(rule
(targets 09.foo)
(action
(run ./incr.exe x %{targets})))
(rule
(targets 10.foo)
(action
(run ./incr.exe x %{targets})))
(rule
(targets 01.bar)
(action
(run ./incr.exe y %{targets}))
(locks m))
(rule
(targets 02.bar)
(action
(run ./incr.exe y %{targets}))
(locks m))
(rule
(targets 03.bar)
(action
(run ./incr.exe y %{targets}))
(locks m))
(rule
(targets 04.bar)
(action
(run ./incr.exe y %{targets}))
(locks m))
(rule
(targets 05.bar)
(action
(run ./incr.exe y %{targets}))
(locks m))
(rule
(targets 06.bar)
(action
(run ./incr.exe y %{targets}))
(locks m))
(rule
(targets 07.bar)
(action
(run ./incr.exe y %{targets}))
(locks m))
(rule
(targets 08.bar)
(action
(run ./incr.exe y %{targets}))
(locks m))
(rule
(targets 09.bar)
(action
(run ./incr.exe y %{targets}))
(locks m))
(rule
(targets 10.bar)
(action
(run ./incr.exe y %{targets}))
(locks m))
|