RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/ CHANGES rpm/rpmio/ Makefile.am testit.sh tfts.c

From: Jeff Johnson <n3npq@mac.com>
Date: Sat 09 Feb 2008 - 00:14:07 CET
Message-Id: <C323C16B-DD0C-4F94-A5B7-7B598D8EB9AE@mac.com>
I'm shopping ideas for designing a reliable  "make check" for rpmio.
Below are some examples of what needs testing and how to test.

I've written exercisers for the basic functionality:

tget		Stat a path, and, iff a file, Fopen/Fread/Fclose the contents
tdir		walk a directory using Opendir/Readdir
tglob	use Glob(3) to expand glob patterns
tfts		use Fts(3) to walk a directory tree.

Paths can be "normal" file paths as well as file:///, ftp://, http://  
or https:// URI's.

I'm almost positive that "normal" paths and file:/// URL's are fully  
functional.

Most of rpmio was built and tested against ftp:// URI's, so I expect  
that functionality
to be mostly (Stat() on a ftp:// directory URI seems broken, and so  
tfts is broken atm)
fixed in the next day or two:

	[jbj@wellfleet rpmio]$ ./tget ftp://localhost/pub/jbj/time.xml
	===== ftp://localhost/pub/jbj/time.xml
	396969608 1543245544 -rw-r--r-- 1 0 0 10018 2005-07-29 00:00:00  
ftp://localhost/pub/jbj/time.xml
	   stat:        1      0.000001 MB      0.087706 secs
	    get:        1      0.010018 MB      0.003858 secs
	[jbj@wellfleet rpmio]$ ./tdir ftp://localhost/pub/jbj
	===== ftp://localhost/pub/jbj/: 162 entries
	   opendir:        1      0.000162 MB      0.091381 secs
	[jbj@wellfleet rpmio]$ ./tglob ftp://localhost/pub/jbj/*
	===== ftp://localhost/pub/jbj/*
	   glob:        1      0.000000 MB      0.092328 secs
	[jbj@wellfleet rpmio]$ ./tfts ftp://localhost/pub/jbj
	===== (0/0) dirs/files in:
	        ftp://localhost/pub/jbj/
	   fts:        1      0.000000 MB      0.031525 secs


Now that http://rpm5.org/files is DAV enabled, I've been using that to
develop the exercisers. ATM, Fts(3) won't walk a tree, only a top  
level directory,
but the other exercisers appear functional:

	[jbj@wellfleet rpmio]$ ./tget http://rpm5.org/files/rpm/rpm-5.1/ 
readme.txt
	===== http://rpm5.org/files/rpm/rpm-5.1/readme.txt
	2332648353 0 -rw-r--r-- 1 0 0 157 2008-01-05 05:01:58 http:// 
rpm5.org/files/rpm/rpm-5.1/readme.txt
	   stat:        1      0.000001 MB      0.743715 secs
	    get:        1      0.000157 MB      0.426203 secs
	[jbj@wellfleet rpmio]$ ./tdir http://rpm5.org/files/rpm/rpm-5.1
	===== http://rpm5.org/files/rpm/rpm-5.1/: 5 entries
	   opendir:        1      0.000005 MB      0.744295 secs
	[jbj@wellfleet rpmio]$ ./tglob http://rpm5.org/files/rpm/rpm-5.1/*
	===== http://rpm5.org/files/rpm/rpm-5.1/*
	   glob:        1      0.000000 MB      0.748786 secs
	[jbj@wellfleet rpmio]$ ./tfts http://rpm5.org/files/rpm/rpm-5.1
	===== (1/1) dirs/files in:
	        http://rpm5.org/files/rpm/rpm-5.1/
	   fts:        1      0.000001 MB      3.551848 secs

I have not yet looked at plain http:// URI's in any detail. I know  
that tglob
will not function at all with non-DAV URL's ... checking ... yes more  
to do
with non-DAV URI's:

	[jbj@wellfleet rpmio]$ ./tget http://rpm5.org/sources.rss.xml
	===== http://rpm5.org/sources.rss.xml
	3586396879 40 -rw-r--r-- 1 0 0 41348 2008-02-08 17:45:07 http:// 
rpm5.org/sources.rss.xml
	   stat:        1      0.000001 MB      0.765802 secs
	    get:        1      0.041348 MB      1.054655 secs
	[jbj@wellfleet rpmio]$ ./tdir http://rpm5.org/
	Segmentation fault
	[jbj@wellfleet rpmio]$ ./tglob http://rpm5.org/*
	===== http://rpm5.org/*
	Segmentation fault
	[jbj@wellfleet rpmio]$ ./tfts http://rpm5.org/
	===== (0/1) dirs/files in:
	        http://rpm5.org/
	   fts:        1      0.000000 MB      1.004163 secs

How should a "make check" rpmio test harness be designed?

As always its the error, not the functional, paths that will
need explicit verification through rpmio.

73 de Jeff

On Feb 8, 2008, at 5:20 PM, Jeff Johnson wrote:

>   RPM Package Manager, CVS Repository
>   http://rpm5.org/cvs/
>    
> ______________________________________________________________________ 
> ______
>
>   Server: rpm5.org                         Name:   Jeff Johnson
>   Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
>   Module: rpm                              Date:   08-Feb-2008  
> 23:20:03
>   Branch: HEAD                             Handle: 2008020822200201
>
>   Added files:
>     rpm/rpmio               testit.sh
>   Modified files:
>     rpm                     CHANGES
>     rpm/rpmio               Makefile.am tfts.c
>
>   Log:
>     - jbj: tie tget/tdir/tglob/tfts to a rpmio "make check". much  
> more to
>     do ...
>
>   Summary:
>     Revision    Changes     Path
>     1.2157      +1  -0      rpm/CHANGES
>     1.122       +7  -2      rpm/rpmio/Makefile.am
>     2.1         +16 -0      rpm/rpmio/testit.sh
>     2.18        +1  -1      rpm/rpmio/tfts.c
>    
> ______________________________________________________________________ 
> ______
>
>   patch -p0 <<'@@ .'
>   Index: rpm/CHANGES
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.2156 -r1.2157 CHANGES
>   --- rpm/CHANGES	8 Feb 2008 21:12:56 -0000	1.2156
>   +++ rpm/CHANGES	8 Feb 2008 22:20:02 -0000	1.2157
>   @@ -1,4 +1,5 @@
>    5.0.0 -> 5.1a1:
>   +    - jbj: tie tget/tdir/tglob/tfts to a rpmio "make check".  
> much more to do ...
>        - jbj: tweak up tglob debugging spew, add a Glob(3) stopwatch.
>        - jbj: tweak up tget debugging spew, trick in a Stat(2) on  
> path,
>    	add Stat(2)/Fread(3) stopwatches, display same as "ls -island"  
> output.
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/rpmio/Makefile.am
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.121 -r1.122 Makefile.am
>   --- rpm/rpmio/Makefile.am	4 Feb 2008 20:09:37 -0000	1.121
>   +++ rpm/rpmio/Makefile.am	8 Feb 2008 22:20:03 -0000	1.122
>   @@ -4,9 +4,14 @@
>
>    LINT = splint
>
>   -EXTRA_DIST = gengpg.sh tdir.c tfts.c tget.c thkp.c tput.c  
> tglob.c tinv.c tkey.c trpmio.c lookup3.c tpw.c librpmio.vers
>   +EXTRA_DIST = gengpg.sh thkp.c tput.c tinv.c tkey.c trpmio.c  
> lookup3.c tpw.c librpmio.vers
>
>   -EXTRA_PROGRAMS = tdir tfts tget tglob thkp tinv tkey tmacro  
> tmagic tmire tput tpw trpmio tsw dumpasn1 lookup3
>   +EXTRA_PROGRAMS = thkp tinv tkey tmacro tmagic tmire tput tpw  
> trpmio tsw dumpasn1 lookup3
>   +
>   +noinst_PROGRAMS = tdir tfts tget tglob
>   +noinst_SCRIPTS = testit.sh
>   +
>   +TESTS = testit.sh
>
>    AM_CPPFLAGS = \
>    	-I$(srcdir) \
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/rpmio/testit.sh
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r0 -r2.1 testit.sh
>   --- /dev/null	2008-02-08 23:11:00 +0100
>   +++ testit.sh	2008-02-08 23:20:03 +0100
>   @@ -0,0 +1,16 @@
>   +#!/bin/sh
>   +
>   +opts=""
>   +paths=". file:///tmp http://rpm5.org/files/popt ftp://localhost/ 
> pub"
>   +
>   +for path in $paths
>   +do
>   +    ./tget $opts $path
>   +    ./tget $opts $path/testit.sh
>   +
>   +    ./tdir $opts $path
>   +
>   +    ./tglob $opts $path/*
>   +
>   +    ./tfts $opts $path
>   +done
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/rpmio/tfts.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r2.17 -r2.18 tfts.c
>   --- rpm/rpmio/tfts.c	8 Feb 2008 21:02:16 -0000	2.17
>   +++ rpm/rpmio/tfts.c	8 Feb 2008 22:20:03 -0000	2.18
>   @@ -258,7 +258,7 @@
>    	size_t nb = strlen(dn);
>    	dn = rpmExpand(dn, (dn[nb-1] != '/' ? "/" : NULL), NULL);
>    	argvAdd(&av, dn);
>   -	dn = _free(nav[0]);
>   +	dn = _free(dn);
>        }
>
>        ftsWalk(av);
>   @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org
Received on Sat Feb 9 00:14:23 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.