delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/04/24/04:29:50

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3AE1927A.261002F1@phekda.freeserve.co.uk>
Date: Sat, 21 Apr 2001 15:00:26 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.17 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: DJGPP workers <djgpp-workers AT delorie DOT com>, Jim Meyering <jim AT meyering DOT net>
Subject: (Fileutils) More test suite & Fetish.pm problems
Reply-To: djgpp-workers AT delorie DOT com

Hello.

I've just been trying to get some tests using Fetish.pm to succeed with
the DJGPP port of Fileutils 4.0. The Fileutils tests invoke a program,
store its output and compare it with some expected output. E.g.:

    program: It worked!

Unfortunately it seems that the DJGPP-compiled programs generate output
like:

    ../../src/program: It worked!

which causes the test to fail.

Essentially there seems to be a difference in behaviour between DJGPP and
Unix when executing programs using the path. Compare the following:

---DJGPP, Fileutils 4.0 port beta 1---
bash-2.04$ type -a df
df is c:/djgpp/bin/df.exe
df is c:/djgpp/bin/df.exe
bash-2.04$ df --goo
c:/djgpp/bin/df: unrecognized option `--goo'
Try `c:/djgpp/bin/df --help' for more information.
bash-2.04$ $DJDIR/bin/df --goo
c:/djgpp/bin/df: unrecognized option `--goo'
Try `c:/djgpp/bin/df --help' for more information.

---RedHat Linux 6.2, glibc 2.1.3, Fileutils 4.0p---
iolanthe:~ =] type -a df
df is /bin/df
iolanthe:~ =] df --goo
df: unrecognized option `--goo'
Try `df --help' for more information.
iolanthe:~ =] /bin/df --goo
/bin/df: unrecognized option `--goo'
Try `/bin/df --help' for more information.

I have no idea whether this difference in behaviour is a bug. The glibc
docs don't seem to comment on what argv[0] should contain when you use
system().

Anyhow here's a workaround. The tests are shell scripts with embedded Perl
programs that use Fetish.pm. The tests have the program name they're
testing hardcoded in the expected output string (e.g. dircolors). The
Makefiles call these Fetish tests with $PROG set to the name of the
program (e.g. dircolors). $PROG is visible as $prog in the Perl test. Now
change:

* the Makefiles to use a relative path instead of relying on searching the
path;

* change the test to use $prog instead of the hardcoded name in the output
string.

I shall use this workaround in beta 2 the Fileutils 4.0 port, out Real
Soon Now.

Bye, Rich =]

-- 
Richard Dawe
http://www.phekda.freeserve.co.uk/richdawe/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019