;; 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))