Lines Matching +full:meson +full:- +full:build +full:- +full:and +full:- +full:test

4 Subject: [PATCH] meson: Make tests optional
6 Now can be disabled with -DSKIP_TESTS=true.
8 It allows to avoid meson error during build when ip isn't installed.
12 Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
13 Signed-off-by: Heiko Becker <heirecka@exherbo.org>
14 [ pvorel: Rename variable TEST => SKIP_TESTS, default false, adjust
16 Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
20 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
21 ---
23 ping/meson.build | 84 ++-----------------------------------------
24 ping/test/meson.build | 81 +++++++++++++++++++++++++++++++++++++++++
25 3 files changed, 86 insertions(+), 82 deletions(-)
26 create mode 100644 ping/test/meson.build
28 diff --git a/meson_options.txt b/meson_options.txt
30 --- a/meson_options.txt
32 @@ -72,3 +72,6 @@ option('INSTALL_SYSTEMD_UNITS', type: 'boolean', value: false,
38 + description: 'Skip tests during build')
39 diff --git a/ping/meson.build b/ping/meson.build
41 --- a/ping/meson.build
42 +++ b/ping/meson.build
43 @@ -27,86 +27,6 @@ if (setcap_ping)
47 -##### TESTS #####
48 -
49 -# TODO: ::1 generates DEPRECATION: ":" is not allowed in test name "ping -c1 ::1", it has been rep…
50 -
51 -# GitHub CI does not have working IPv6
52 -# https://github.com/actions/virtual-environments/issues/668
53 -ipv6_dst = []
54 -ipv6_switch = []
55 -r = run_command('ip', '-6', 'a')
56 -if r.stdout().strip().contains('::1')
57 - message('IPv6 enabled')
58 - ipv6_dst = [ '::1' ]
59 - ipv6_switch = [ '-6' ]
60 -else
61 - message('WARNING: IPv6 disabled')
63 + subdir('test')
65 -
66 -run_as_root = false
67 -r = run_command('id', '-u')
68 -if r.stdout().strip().to_int() == 0
69 - message('running as root')
70 - run_as_root = true
71 -else
72 - message('running as normal user')
73 -endif
74 -
75 -foreach dst : [ 'localhost', '127.0.0.1' ] + ipv6_dst
76 - foreach switch : [ '', '-4' ] + ipv6_switch
77 - args = [ '-c1', dst ]
78 - should_fail = false
79 -
80 - if switch != ''
81 - args = [switch] + args
82 - if (switch == '-4' and dst == '::1') or (switch == '-6' and dst == '127.0.0.1')
83 - should_fail = true
84 - endif
85 - endif
86 -
87 - name = 'ping ' + ' '.join(args)
88 - test(name, ping, args : args, should_fail : should_fail)
89 - endforeach
90 -endforeach
91 -
92 -ping_tests_opt = [
93 - [ '-c1' ],
94 - [ '-c5', '-i0.1' ],
95 - [ '-c1', '-I', 'lo' ],
96 - [ '-c1', '-w1' ],
97 - [ '-c1', '-W1' ],
98 - [ '-c1', '-W1.1' ],
99 -]
100 -foreach dst : [ '127.0.0.1' ] + ipv6_dst
101 - foreach args : ping_tests_opt
102 - args += [ dst ]
103 - name = 'ping ' + ' '.join(args)
104 - test(name, ping, args : args)
105 - endforeach
106 -endforeach
107 -
108 -ping_tests_opt_fail = [
109 - [ '-c1.1' ],
110 - [ '-I', 'nonexisting' ],
111 - [ '-w0.1' ],
112 - [ '-w0,1' ],
113 -]
114 -foreach dst : [ '127.0.0.1' ] + ipv6_dst
115 - foreach args : ping_tests_opt_fail
116 - args += [ dst ]
117 - name = 'ping ' + ' '.join(args)
118 - test(name, ping, args : args, should_fail : true)
119 - endforeach
120 -endforeach
121 -
122 -ping_tests_user_fail = [
123 - [ '-c1', '-i0.001' ], # -c1 required to quit ping when running as root
124 -]
125 -foreach dst : [ '127.0.0.1' ] + ipv6_dst
126 - foreach args : ping_tests_user_fail
127 - args += [ dst ]
128 - name = 'ping ' + ' '.join(args)
129 - test(name, ping, args : args, should_fail : not run_as_root)
130 - endforeach
131 -endforeach
132 diff --git a/ping/test/meson.build b/ping/test/meson.build
135 --- /dev/null
136 +++ b/ping/test/meson.build
137 @@ -0,0 +1,81 @@
138 +# TODO: ::1 generates DEPRECATION: ":" is not allowed in test name "ping -c1 ::1", it has been rep…
141 +# https://github.com/actions/virtual-environments/issues/668
144 +r = run_command('ip', '-6', 'a')
148 + ipv6_switch = [ '-6' ]
154 +r = run_command('id', '-u')
163 + foreach switch : [ '', '-4' ] + ipv6_switch
164 + args = [ '-c1', dst ]
169 + if (switch == '-4' and dst == '::1') or (switch == '-6' and dst == '127.0.0.1')
175 + test(name, ping, args : args, should_fail : should_fail)
180 + [ '-c1' ],
181 + [ '-c5', '-i0.1' ],
182 + [ '-c1', '-I', 'lo' ],
183 + [ '-c1', '-w1' ],
184 + [ '-c1', '-W1' ],
185 + [ '-c1', '-W1.1' ],
191 + test(name, ping, args : args)
196 + [ '-c1.1' ],
197 + [ '-I', 'nonexisting' ],
198 + [ '-w0.1' ],
199 + [ '-w0,1' ],
205 + test(name, ping, args : args, should_fail : true)
210 + [ '-c1', '-i0.001' ], # -c1 required to quit ping when running as root
216 + test(name, ping, args : args, should_fail : not run_as_root)