You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.4 KiB

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