[Libsysio-commit] HEAD: libsysio/tests Makefile.am sysio_tests.c test_copy.pl test_driver.c
Brought to you by:
lward
From: Sonja T. <so...@us...> - 2004-04-12 19:45:28
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32176/tests Modified Files: Makefile.am sysio_tests.c test_copy.pl test_driver.c Log Message: Fixing tests so that they work with glibc 2.2 and 2.3. Added -static flag to Makefile.am so that it correctly links in libsysio. Note that I added it to ALL the tests, not just test_driver (I couldn't figure out how to add it just to test_driver and make it still work). The change in test_driver.c where I open /dev/stdin, /dev/stdout, and /dev/stderr is a hack put in temporarily so that the tests will work until the opens get added to the namespace assembly (which will take me longer to do). Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- Makefile.am 14 Feb 2004 19:42:59 -0000 1.19 +++ Makefile.am 12 Apr 2004 19:31:36 -0000 1.20 @@ -110,5 +110,5 @@ drv_data.c: $(CONFIG_DEPENDENCIES) $(top test -z "drv_data.c" && rm -f drv_data.c; \ $(SHELL) $(top_srcdir)/tests/gendrvdata.sh $(DRIVERS) > drv_data.c -AM_CFLAGS = -L$(LIBBUILD_DIR) +AM_CFLAGS = -static -L$(LIBBUILD_DIR) include $(top_srcdir)/Rules.make Index: sysio_tests.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/sysio_tests.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- sysio_tests.c 12 Mar 2004 20:42:41 -0000 1.7 +++ sysio_tests.c 12 Apr 2004 19:31:36 -0000 1.8 @@ -33,19 +33,6 @@ int initilize_sysio() { int err; char *wd; - extern int _test_sysio_startup(void); - - /* - * Init sysio lib. - */ - err = _test_sysio_startup(); - DBG(5, sprintf(output, "%s_test_sysio_startup: err %d\n", output, err)); - if (err) { - my_errno = err; - my_perror("sysio startup"); - last_ret_val = errno; - return SUCCESS; - } /* * Attempt to set the cwd by getting it out of the Index: test_copy.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- test_copy.pl 14 Feb 2004 19:43:00 -0000 1.5 +++ test_copy.pl 12 Apr 2004 19:31:36 -0000 1.6 @@ -68,12 +68,14 @@ sub process_cmd $bufsize = $size; } - + my $cmdstr; # Open src - my $cmdstr = '$src = CALL open '."$src O_RDONLY\n"; + if ($src ne "/dev/stdin") { + $cmdstr = '$src = CALL open '."$src O_RDONLY\n"; helper::send_cmd($cmdfh, $outfh, "open", $cmdstr); helper::verify_cmd($cmdfh, $outfh, "open $src"); - + } + if ($dest ne "/dev/stdout") { # Open dest my $flags = "O_WRONLY|O_CREAT"; if ($overwrite == 0) { @@ -82,6 +84,7 @@ sub process_cmd $cmdstr = '$dest = CALL open '."$dest $flags 0666\n"; helper::send_cmd($cmdfh, $outfh, "open", $cmdstr); my $destfile = helper::verify_cmd($cmdfh, $outfh, "open $dest"); + } # Allocate buffer $cmdstr = '$buf = ALLOC '."$bufsize\n"; @@ -96,7 +99,7 @@ sub process_cmd if ($src eq "/dev/stdin") { # Send "delay" option to read which will give us time to # put something in stdin (since we can't send an eof) - my $cmdstr = "CALL read ".'$src $buf '."$bytes delay\n"; + my $cmdstr = "CALL read ".'0 $buf '."$bytes delay\n"; print $cmdfh $cmdstr; # Give time to process command sleep 1; @@ -119,7 +122,11 @@ sub process_cmd helper::print_and_exit($cmdfh, $outfh, 0, "Short read\n"); } + if ($dest eq "/dev/stdout") { + $cmdstr = "CALL write ".'1 $buf '."$readb\n"; + } else { $cmdstr = "CALL write ".'$dest $buf '."$readb\n"; + } print $cmdfh $cmdstr; # Suck up the stdout... @@ -156,11 +163,14 @@ sub process_cmd } # Clean up + if ($src ne "/dev/stdin") { $cmdstr = 'CALL close $src'."\n"; helper::send_cmd($cmdfh, $outfh, "close", $cmdstr); + } + if ($dest ne "/dev/stdout") { $cmdstr = 'CALL close $dest'."\n"; helper::send_cmd($cmdfh, $outfh, "close", $cmdstr); - + } if ($src ne "/dev/stdin") { my $cmpres = system("cmp -s $src $dest"); if ($cmpres != 0) { Index: test_driver.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_driver.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- test_driver.c 24 Feb 2004 15:46:34 -0000 1.8 +++ test_driver.c 12 Apr 2004 19:31:36 -0000 1.9 @@ -961,6 +961,17 @@ int main(int argc, char *argv[]) char *input, *name; char **cmd; cmd_tree *tree; + extern int _test_sysio_startup(void); + + /* + * Init sysio lib. + */ + err = _test_sysio_startup(); + + /* Temp. hack until I do the right thing to fix this...*/ + open("/dev/stdin",O_RDONLY); + open("/dev/stdout",O_WRONLY); + open("/dev/stderr",O_WRONLY); infp = stdin; outfp = stdout; |