From: | "Mike Frysinger (vapier)" <vapier@g.o> |
---|---|
To: | gentoo-commits@l.g.o |
Subject: | [gentoo-commits] gentoo-x86 commit in eclass/tests: multiprocessing.sh multiprocessing:makeopts_jobs.sh eutils:makeopts_jobs.sh |
Date: | Thu, 07 Jun 2012 05:00:33 |
Message-Id: | 20120607050023.D154E2004B@flycatcher.gentoo.org |
1 | vapier 12/06/07 05:00:23 |
2 | |
3 | Added: multiprocessing.sh multiprocessing:makeopts_jobs.sh |
4 | Removed: eutils:makeopts_jobs.sh |
5 | Log: |
6 | add tests for new multiprocessing eclass |
7 | |
8 | Revision Changes Path |
9 | 1.1 eclass/tests/multiprocessing.sh |
10 | |
11 | file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/multiprocessing.sh?rev=1.1&view=markup |
12 | plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/multiprocessing.sh?rev=1.1&content-type=text/plain |
13 | |
14 | Index: multiprocessing.sh |
15 | =================================================================== |
16 | #!/bin/bash |
17 | |
18 | source tests-common.sh |
19 | |
20 | inherit multiprocessing |
21 | |
22 | tbegin "simple" |
23 | MAKEOPTS="-j1" multijob_init |
24 | multijob_child_init ls -d / >/dev/null || die "fail!" |
25 | multijob_finish |
26 | tend $? |
27 | |
28 | tbegin "less simple" |
29 | multijob_init -j3 |
30 | multijob_child_init true || die "fail!" |
31 | multijob_child_init false || die "fail!" |
32 | multijob_child_init true || die "fail!" |
33 | multijob_finish |
34 | tend $(( $? == 1 ? 0 : 1 )) |
35 | |
36 | tbegin "less less simple" |
37 | multijob_init -j1 |
38 | multijob_child_init true || die "fail!" |
39 | multijob_child_init false || die "fail!" |
40 | multijob_child_init true && die "fail!" |
41 | multijob_finish |
42 | tend $? |
43 | |
44 | tbegin "less less less simple" |
45 | multijob_init -j10 |
46 | multijob_child_init true || die "fail!" |
47 | multijob_finish_one || die "fail!" |
48 | multijob_child_init false || die "fail!" |
49 | multijob_finish_one && die "fail!" |
50 | multijob_child_init true || die "fail!" |
51 | multijob_finish_one || die "fail!" |
52 | multijob_finish |
53 | tend $? |
54 | |
55 | texit |
56 | |
57 | |
58 | |
59 | 1.1 eclass/tests/multiprocessing:makeopts_jobs.sh |
60 | |
61 | file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/multiprocessing:makeopts_jobs.sh?rev=1.1&view=markup |
62 | plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/multiprocessing:makeopts_jobs.sh?rev=1.1&content-type=text/plain |
63 | |
64 | Index: multiprocessing:makeopts_jobs.sh |
65 | =================================================================== |
66 | #!/bin/bash |
67 | |
68 | source tests-common.sh |
69 | |
70 | inherit multiprocessing |
71 | |
72 | test-makeopts_jobs() { |
73 | local exp=$1; shift |
74 | tbegin "makeopts_jobs($*) == ${exp}" |
75 | local act=$(makeopts_jobs "$@") |
76 | [[ ${act} == "${exp}" ]] |
77 | tend $? "Got back: ${act}" |
78 | } |
79 | |
80 | tests=( |
81 | 999 "-j" |
82 | 999 "--jobs" |
83 | 1 "" |
84 | 1 "-l9 -w" |
85 | 1 "-l9 -w-j4" |
86 | 1 "-l9--jobs=3" |
87 | 1 "-l9--jobs=8" |
88 | 2 "-j2" |
89 | 3 "-j 3" |
90 | 4 "-l3 -j 4 -w" |
91 | 5 "--jobs=5" |
92 | 6 "--jobs 6" |
93 | 7 "-l3 --jobs 7 -w" |
94 | 4 "-j1 -j 2 --jobs 3 --jobs=4" |
95 | 8 " -j 8 " |
96 | ) |
97 | for (( i = 0; i < ${#tests[@]}; i += 2 )) ; do |
98 | test-makeopts_jobs "${tests[i]}" "${tests[i+1]}" |
99 | done |
100 | |
101 | texit |