File: parallel.rs

package info (click to toggle)
rust-just 1.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,196 kB
  • sloc: sh: 300; makefile: 6
file content (105 lines) | stat: -rw-r--r-- 1,386 bytes parent folder | download
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
use super::*;

#[test]
#[ignore]
fn prior_dependencies_run_in_parallel() {
  let start = Instant::now();

  Test::new()
    .justfile(
      "
        [parallel]
        foo: a b c d e

        a:
          sleep 1

        b:
          sleep 1

        c:
          sleep 1

        d:
          sleep 1

        e:
          sleep 1
      ",
    )
    .stderr(
      "
        sleep 1
        sleep 1
        sleep 1
        sleep 1
        sleep 1
      ",
    )
    .run();

  assert!(start.elapsed() < Duration::from_secs(2));
}

#[test]
#[ignore]
fn subsequent_dependencies_run_in_parallel() {
  let start = Instant::now();

  Test::new()
    .justfile(
      "
        [parallel]
        foo: && a b c d e

        a:
          sleep 1

        b:
          sleep 1

        c:
          sleep 1

        d:
          sleep 1

        e:
          sleep 1
      ",
    )
    .stderr(
      "
        sleep 1
        sleep 1
        sleep 1
        sleep 1
        sleep 1
      ",
    )
    .run();

  assert!(start.elapsed() < Duration::from_secs(2));
}

#[test]
fn parallel_dependencies_report_errors() {
  Test::new()
    .justfile(
      "
        [parallel]
        foo: bar

        bar:
          exit 1
      ",
    )
    .stderr(
      "
        exit 1
        error: Recipe `bar` failed on line 5 with exit code 1
      ",
    )
    .status(EXIT_FAILURE)
    .run();
}