diff options
| -rw-r--r-- | meta/recipes-extended/iputils/iputils/0001-meson-Make-tests-optional.patch | 220 | ||||
| -rw-r--r-- | meta/recipes-extended/iputils/iputils_20210722.bb | 3 |
2 files changed, 222 insertions, 1 deletions
diff --git a/meta/recipes-extended/iputils/iputils/0001-meson-Make-tests-optional.patch b/meta/recipes-extended/iputils/iputils/0001-meson-Make-tests-optional.patch new file mode 100644 index 0000000000..9f17cbdb87 --- /dev/null +++ b/meta/recipes-extended/iputils/iputils/0001-meson-Make-tests-optional.patch | |||
| @@ -0,0 +1,220 @@ | |||
| 1 | From d8048d60d30a2efe7883b36626123630ce69b9fc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Heiko Becker <heirecka@exherbo.org> | ||
| 3 | Date: Fri, 23 Jul 2021 16:32:46 +0200 | ||
| 4 | Subject: [PATCH] meson: Make tests optional | ||
| 5 | |||
| 6 | Now can be disabled with -DSKIP_TESTS=true. | ||
| 7 | |||
| 8 | It allows to avoid meson error during build when ip isn't installed. | ||
| 9 | |||
| 10 | Closes: #359 | ||
| 11 | |||
| 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 | ||
| 15 | the description ] | ||
| 16 | Signed-off-by: Petr Vorel <petr.vorel@gmail.com> | ||
| 17 | |||
| 18 | Upstream-Status: Backport [3163c49f9f4ad473a00d8a345ee334a028376011] | ||
| 19 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
| 20 | --- | ||
| 21 | meson_options.txt | 3 ++ | ||
| 22 | ping/meson.build | 84 ++----------------------------------------- | ||
| 23 | ping/test/meson.build | 81 +++++++++++++++++++++++++++++++++++++++++ | ||
| 24 | 3 files changed, 86 insertions(+), 82 deletions(-) | ||
| 25 | create mode 100644 ping/test/meson.build | ||
| 26 | |||
| 27 | diff --git a/meson_options.txt b/meson_options.txt | ||
| 28 | index ac5f5d9..517667f 100644 | ||
| 29 | --- a/meson_options.txt | ||
| 30 | +++ b/meson_options.txt | ||
| 31 | @@ -72,3 +72,6 @@ option('INSTALL_SYSTEMD_UNITS', type: 'boolean', value: false, | ||
| 32 | |||
| 33 | option('USE_GETTEXT', type: 'boolean', value: true, | ||
| 34 | description: 'Enable I18N') | ||
| 35 | + | ||
| 36 | +option('SKIP_TESTS', type: 'boolean', value: false, | ||
| 37 | + description: 'Skip tests during build') | ||
| 38 | diff --git a/ping/meson.build b/ping/meson.build | ||
| 39 | index 1e678ec..83ea353 100644 | ||
| 40 | --- a/ping/meson.build | ||
| 41 | +++ b/ping/meson.build | ||
| 42 | @@ -27,86 +27,6 @@ if (setcap_ping) | ||
| 43 | ) | ||
| 44 | endif | ||
| 45 | |||
| 46 | -##### TESTS ##### | ||
| 47 | - | ||
| 48 | -# TODO: ::1 generates DEPRECATION: ":" is not allowed in test name "ping -c1 ::1", it has been replaced with "_" | ||
| 49 | - | ||
| 50 | -# GitHub CI does not have working IPv6 | ||
| 51 | -# https://github.com/actions/virtual-environments/issues/668 | ||
| 52 | -ipv6_dst = [] | ||
| 53 | -ipv6_switch = [] | ||
| 54 | -r = run_command('ip', '-6', 'a') | ||
| 55 | -if r.stdout().strip().contains('::1') | ||
| 56 | - message('IPv6 enabled') | ||
| 57 | - ipv6_dst = [ '::1' ] | ||
| 58 | - ipv6_switch = [ '-6' ] | ||
| 59 | -else | ||
| 60 | - message('WARNING: IPv6 disabled') | ||
| 61 | +if not get_option('SKIP_TESTS') | ||
| 62 | + subdir('test') | ||
| 63 | endif | ||
| 64 | - | ||
| 65 | -run_as_root = false | ||
| 66 | -r = run_command('id', '-u') | ||
| 67 | -if r.stdout().strip().to_int() == 0 | ||
| 68 | - message('running as root') | ||
| 69 | - run_as_root = true | ||
| 70 | -else | ||
| 71 | - message('running as normal user') | ||
| 72 | -endif | ||
| 73 | - | ||
| 74 | -foreach dst : [ 'localhost', '127.0.0.1' ] + ipv6_dst | ||
| 75 | - foreach switch : [ '', '-4' ] + ipv6_switch | ||
| 76 | - args = [ '-c1', dst ] | ||
| 77 | - should_fail = false | ||
| 78 | - | ||
| 79 | - if switch != '' | ||
| 80 | - args = [switch] + args | ||
| 81 | - if (switch == '-4' and dst == '::1') or (switch == '-6' and dst == '127.0.0.1') | ||
| 82 | - should_fail = true | ||
| 83 | - endif | ||
| 84 | - endif | ||
| 85 | - | ||
| 86 | - name = 'ping ' + ' '.join(args) | ||
| 87 | - test(name, ping, args : args, should_fail : should_fail) | ||
| 88 | - endforeach | ||
| 89 | -endforeach | ||
| 90 | - | ||
| 91 | -ping_tests_opt = [ | ||
| 92 | - [ '-c1' ], | ||
| 93 | - [ '-c5', '-i0.1' ], | ||
| 94 | - [ '-c1', '-I', 'lo' ], | ||
| 95 | - [ '-c1', '-w1' ], | ||
| 96 | - [ '-c1', '-W1' ], | ||
| 97 | - [ '-c1', '-W1.1' ], | ||
| 98 | -] | ||
| 99 | -foreach dst : [ '127.0.0.1' ] + ipv6_dst | ||
| 100 | - foreach args : ping_tests_opt | ||
| 101 | - args += [ dst ] | ||
| 102 | - name = 'ping ' + ' '.join(args) | ||
| 103 | - test(name, ping, args : args) | ||
| 104 | - endforeach | ||
| 105 | -endforeach | ||
| 106 | - | ||
| 107 | -ping_tests_opt_fail = [ | ||
| 108 | - [ '-c1.1' ], | ||
| 109 | - [ '-I', 'nonexisting' ], | ||
| 110 | - [ '-w0.1' ], | ||
| 111 | - [ '-w0,1' ], | ||
| 112 | -] | ||
| 113 | -foreach dst : [ '127.0.0.1' ] + ipv6_dst | ||
| 114 | - foreach args : ping_tests_opt_fail | ||
| 115 | - args += [ dst ] | ||
| 116 | - name = 'ping ' + ' '.join(args) | ||
| 117 | - test(name, ping, args : args, should_fail : true) | ||
| 118 | - endforeach | ||
| 119 | -endforeach | ||
| 120 | - | ||
| 121 | -ping_tests_user_fail = [ | ||
| 122 | - [ '-c1', '-i0.001' ], # -c1 required to quit ping when running as root | ||
| 123 | -] | ||
| 124 | -foreach dst : [ '127.0.0.1' ] + ipv6_dst | ||
| 125 | - foreach args : ping_tests_user_fail | ||
| 126 | - args += [ dst ] | ||
| 127 | - name = 'ping ' + ' '.join(args) | ||
| 128 | - test(name, ping, args : args, should_fail : not run_as_root) | ||
| 129 | - endforeach | ||
| 130 | -endforeach | ||
| 131 | diff --git a/ping/test/meson.build b/ping/test/meson.build | ||
| 132 | new file mode 100644 | ||
| 133 | index 0000000..43aed75 | ||
| 134 | --- /dev/null | ||
| 135 | +++ b/ping/test/meson.build | ||
| 136 | @@ -0,0 +1,81 @@ | ||
| 137 | +# TODO: ::1 generates DEPRECATION: ":" is not allowed in test name "ping -c1 ::1", it has been replaced with "_" | ||
| 138 | + | ||
| 139 | +# GitHub CI does not have working IPv6 | ||
| 140 | +# https://github.com/actions/virtual-environments/issues/668 | ||
| 141 | +ipv6_dst = [] | ||
| 142 | +ipv6_switch = [] | ||
| 143 | +r = run_command('ip', '-6', 'a') | ||
| 144 | +if r.stdout().strip().contains('::1') | ||
| 145 | + message('IPv6 enabled') | ||
| 146 | + ipv6_dst = [ '::1' ] | ||
| 147 | + ipv6_switch = [ '-6' ] | ||
| 148 | +else | ||
| 149 | + message('WARNING: IPv6 disabled') | ||
| 150 | +endif | ||
| 151 | + | ||
| 152 | +run_as_root = false | ||
| 153 | +r = run_command('id', '-u') | ||
| 154 | +if r.stdout().strip().to_int() == 0 | ||
| 155 | + message('running as root') | ||
| 156 | + run_as_root = true | ||
| 157 | +else | ||
| 158 | + message('running as normal user') | ||
| 159 | +endif | ||
| 160 | + | ||
| 161 | +foreach dst : [ 'localhost', '127.0.0.1' ] + ipv6_dst | ||
| 162 | + foreach switch : [ '', '-4' ] + ipv6_switch | ||
| 163 | + args = [ '-c1', dst ] | ||
| 164 | + should_fail = false | ||
| 165 | + | ||
| 166 | + if switch != '' | ||
| 167 | + args = [switch] + args | ||
| 168 | + if (switch == '-4' and dst == '::1') or (switch == '-6' and dst == '127.0.0.1') | ||
| 169 | + should_fail = true | ||
| 170 | + endif | ||
| 171 | + endif | ||
| 172 | + | ||
| 173 | + name = 'ping ' + ' '.join(args) | ||
| 174 | + test(name, ping, args : args, should_fail : should_fail) | ||
| 175 | + endforeach | ||
| 176 | +endforeach | ||
| 177 | + | ||
| 178 | +ping_tests_opt = [ | ||
| 179 | + [ '-c1' ], | ||
| 180 | + [ '-c5', '-i0.1' ], | ||
| 181 | + [ '-c1', '-I', 'lo' ], | ||
| 182 | + [ '-c1', '-w1' ], | ||
| 183 | + [ '-c1', '-W1' ], | ||
| 184 | + [ '-c1', '-W1.1' ], | ||
| 185 | +] | ||
| 186 | +foreach dst : [ '127.0.0.1' ] + ipv6_dst | ||
| 187 | + foreach args : ping_tests_opt | ||
| 188 | + args += [ dst ] | ||
| 189 | + name = 'ping ' + ' '.join(args) | ||
| 190 | + test(name, ping, args : args) | ||
| 191 | + endforeach | ||
| 192 | +endforeach | ||
| 193 | + | ||
| 194 | +ping_tests_opt_fail = [ | ||
| 195 | + [ '-c1.1' ], | ||
| 196 | + [ '-I', 'nonexisting' ], | ||
| 197 | + [ '-w0.1' ], | ||
| 198 | + [ '-w0,1' ], | ||
| 199 | +] | ||
| 200 | +foreach dst : [ '127.0.0.1' ] + ipv6_dst | ||
| 201 | + foreach args : ping_tests_opt_fail | ||
| 202 | + args += [ dst ] | ||
| 203 | + name = 'ping ' + ' '.join(args) | ||
| 204 | + test(name, ping, args : args, should_fail : true) | ||
| 205 | + endforeach | ||
| 206 | +endforeach | ||
| 207 | + | ||
| 208 | +ping_tests_user_fail = [ | ||
| 209 | + [ '-c1', '-i0.001' ], # -c1 required to quit ping when running as root | ||
| 210 | +] | ||
| 211 | +foreach dst : [ '127.0.0.1' ] + ipv6_dst | ||
| 212 | + foreach args : ping_tests_user_fail | ||
| 213 | + args += [ dst ] | ||
| 214 | + name = 'ping ' + ' '.join(args) | ||
| 215 | + test(name, ping, args : args, should_fail : not run_as_root) | ||
| 216 | + endforeach | ||
| 217 | +endforeach | ||
| 218 | -- | ||
| 219 | 2.30.2 | ||
| 220 | |||
diff --git a/meta/recipes-extended/iputils/iputils_20210722.bb b/meta/recipes-extended/iputils/iputils_20210722.bb index c2a5bf44ea..2e8d9032e4 100644 --- a/meta/recipes-extended/iputils/iputils_20210722.bb +++ b/meta/recipes-extended/iputils/iputils_20210722.bb | |||
| @@ -12,6 +12,7 @@ DEPENDS = "gnutls" | |||
| 12 | 12 | ||
| 13 | SRC_URI = "git://github.com/iputils/iputils \ | 13 | SRC_URI = "git://github.com/iputils/iputils \ |
| 14 | file://0001-rarpd-rdisc-Drop-PrivateUsers.patch \ | 14 | file://0001-rarpd-rdisc-Drop-PrivateUsers.patch \ |
| 15 | file://0001-meson-Make-tests-optional.patch \ | ||
| 15 | " | 16 | " |
| 16 | SRCREV = "71bb2a6c72e9f658e90ac618c73d873a76bbaa81" | 17 | SRCREV = "71bb2a6c72e9f658e90ac618c73d873a76bbaa81" |
| 17 | 18 | ||
| @@ -38,7 +39,7 @@ PACKAGECONFIG[docs] = "-DBUILD_HTML_MANS=true -DBUILD_MANS=true,-DBUILD_HTML_MAN | |||
| 38 | 39 | ||
| 39 | inherit meson systemd update-alternatives | 40 | inherit meson systemd update-alternatives |
| 40 | 41 | ||
| 41 | EXTRA_OEMESON += "--prefix=${root_prefix}/" | 42 | EXTRA_OEMESON += "--prefix=${root_prefix}/ -DSKIP_TESTS=true" |
| 42 | 43 | ||
| 43 | ALTERNATIVE_PRIORITY = "100" | 44 | ALTERNATIVE_PRIORITY = "100" |
| 44 | 45 | ||
