Autrijus Tang wrote:
> On Wed, Dec 10, 2003 at 02:51:15PM -0000, Ian Cass wrote:
> Is it possible for you to reduce this to a perl program that
> prints "not ok 1\n" when it works, and "ok 1\n" when it does
> not (shelling out to `ps` is fine)?  That will enable us to
> run automatic blame-analyzers to pinpoint the perl core change
> that caused (or would fix) this problem.

Well, it'll be tricky to do this in a portable manner unless you want to
depend on Proc::ProcessTable or something?

Anyhow, I knocked something up that works on Debian Linux. The output looks
like this..

[EMAIL PROTECTED]:~$ ./helloworld
1..1
# I think I'm helloworld
# ps says I'm helloworld
ok 1
[EMAIL PROTECTED]:~$ ./helloworld --test
1..1
# Testing with arguments
# I think I'm helloworld
# ps says I'm helloworl
not ok 1

Here's the source. The bug only shows after it's 'compiled' with pp, so your
test scripts will have to run it past pp first.

[EMAIL PROTECTED]:~$ more helloworld.pl
use File::Basename;
print "1..1\n";
($header, $command) = split /\n/ ,`ps p $$ -o command`;
$command = basename($command);
print "# Testing with arguments\n" if @ARGV;
print "# I think I'm " . basename($0) . "\n";
print "# ps says I'm " . basename($command) . "\n";
basename($command) =~ basename($0)?print "ok 1\n":print "not ok 1\n";

Is that what you wanted?

--
Ian Cass

Reply via email to