Merge pull request #2126 from lynxis/libmicrohttpd
[feed/packages.git] / lang / perl / patches / 710-threads_join-skip_ps_on_busybox.patch
1 perl: Skip $0 test on busybox
2
3 This test requires a ps which provides the -f option, as well as suitable output.
4 We can't provide either with busybox. Just skip it for now.
5
6 Signed-off-by: Marcel Denia <naoir@gmx.net>
7
8 --- a/dist/threads/t/join.t
9 +++ b/dist/threads/t/join.t
10 @@ -110,36 +110,41 @@ sub skip {
11
12 # We parse ps output so this is OS-dependent.
13 if ($^O eq 'linux') {
14 - # First modify $0 in a subthread.
15 - #print "# mainthread: \$0 = $0\n";
16 - threads->create(sub{ #print "# subthread: \$0 = $0\n";
17 - $0 = "foobar";
18 - #print "# subthread: \$0 = $0\n"
19 - })->join;
20 - #print "# mainthread: \$0 = $0\n";
21 - #print "# pid = $$\n";
22 - if (open PS, "ps -f |") { # Note: must work in (all) systems.
23 - my ($sawpid, $sawexe);
24 - while (<PS>) {
25 - chomp;
26 - #print "# [$_]\n";
27 - if (/^\s*\S+\s+$$\s/) {
28 - $sawpid++;
29 - if (/\sfoobar\s*$/) { # Linux 2.2 leaves extra trailing spaces.
30 - $sawexe++;
31 - }
32 - last;
33 - }
34 - }
35 - close PS or die;
36 - if ($sawpid) {
37 - ok($sawpid && $sawexe, 'altering $0 is effective');
38 - } else {
39 - skip("\$0 check: did not see pid $$ in 'ps -f |'");
40 - }
41 - } else {
42 - skip("\$0 check: opening 'ps -f |' failed: $!");
43 - }
44 + if (readlink('/bin/ps') ne 'busybox') {
45 + # First modify $0 in a subthread.
46 + #print "# mainthread: \$0 = $0\n";
47 + threads->create(sub{ #print "# subthread: \$0 = $0\n";
48 + $0 = "foobar";
49 + #print "# subthread: \$0 = $0\n"
50 + })->join;
51 + #print "# mainthread: \$0 = $0\n";
52 + #print "# pid = $$\n";
53 + if (open PS, "ps -f |") { # Note: must work in (all) systems.
54 + my ($sawpid, $sawexe);
55 + while (<PS>) {
56 + chomp;
57 + #print "# [$_]\n";
58 + if (/^\s*\S+\s+$$\s/) {
59 + $sawpid++;
60 + if (/\sfoobar\s*$/) { # Linux 2.2 leaves extra trailing spaces.
61 + $sawexe++;
62 + }
63 + last;
64 + }
65 + }
66 + close PS or die;
67 + if ($sawpid) {
68 + ok($sawpid && $sawexe, 'altering $0 is effective');
69 + } else {
70 + skip("\$0 check: did not see pid $$ in 'ps -f |'");
71 + }
72 + } else {
73 + skip("\$0 check: opening 'ps -f |' failed: $!");
74 + }
75 + }
76 + else {
77 + skip("\$0 check: incompatible with busybox");
78 + }
79 } else {
80 skip("\$0 check: only on Linux");
81 }