[Lsb-messages] /var/www/bzr/lsb/devel/printing-test r91: Add tests for ippWriteIO, ippReadIO (bug 3087), ippReadFile (disabled atm)

Stew Benedict stewb at linux-foundation.org
Tue May 15 16:26:15 UTC 2012


------------------------------------------------------------
revno: 91
committer: Stew Benedict <stewb at linux-foundation.org>
branch nick: printing-test
timestamp: Tue 2012-05-15 12:26:15 -0400
message:
  Add tests for ippWriteIO, ippReadIO (bug 3087), ippReadFile (disabled atm)
added:
  scripts/package/lsb-test-printing-add-ipp-tests.patch
  sources/printing-test/ipp/
  sources/printing-test/ipp/LSBTest.ipp
modified:
  scripts/package/Makefile
  scripts/package/lsb-test-printing.spec.sed
  sources/printing-test/tet_scen
-------------- next part --------------
=== modified file 'scripts/package/Makefile'
--- a/scripts/package/Makefile	2012-04-24 21:09:03 +0000
+++ b/scripts/package/Makefile	2012-05-15 16:26:15 +0000
@@ -1,7 +1,7 @@
 # XXX We should play the usual tricks defining stuff here and building
 # XXX a specfile from this info, but not yet: for now keep in sync
 PACKAGE=lsb-test-printing
-VERSION=4.1.2
+VERSION=4.1.3
 RELEASE=1
 
 # CUPS version, tarball

=== added file 'scripts/package/lsb-test-printing-add-ipp-tests.patch'
--- a/scripts/package/lsb-test-printing-add-ipp-tests.patch	1970-01-01 00:00:00 +0000
+++ b/scripts/package/lsb-test-printing-add-ipp-tests.patch	2012-05-15 16:26:15 +0000
@@ -0,0 +1,235 @@
+--- ./cups-1.1.23/cups/Makefile.bug-3087	2005-01-03 14:29:45.000000000 -0500
++++ ./cups-1.1.23/cups/Makefile	2012-05-15 11:04:10.813224595 -0400
+@@ -51,6 +51,10 @@ HEADERS	=	cups.h http.h ipp.h language.h
+ TARGETS	=	$(LIBCUPS) libcups.a \
+ 		testhttp testipp testlang
+ 
++# tet stuff
++INCLUDES = -I/opt/lsb-tet3-lite/inc/tet3
++TETLIBS = /opt/lsb-tet3-lite/lib/tet3/tcm.o /opt/lsb-tet3-lite/lib/tet3/libapi.a
++TETINC = /opt/lsb-tet3-lite/inc/tet3
+ 
+ #
+ # Make all targets...
+@@ -186,9 +190,12 @@ testhttp:	testhttp.o libcups.a
+ # testipp (dependency on static CUPS library is intentional)
+ #
+ 
+-testipp:	testipp.o libcups.a
++testipp.o:
++	$(CC) -c testipp.c -I$(TETINC) -I..
++
++testipp:	testipp.o
+ 	echo Linking $@...
+-	$(CC) $(LDFLAGS) -o $@ testipp.o libcups.a $(NETLIBS) $(SSLLIBS) $(COMMONLIBS)
++	$(CC) $(LDFLAGS) -o $@ testipp.o $(TETLIBS) -lcups $(NETLIBS) $(SSLLIBS) $(COMMONLIBS)
+ 
+ 
+ #
+--- ./cups-1.1.23/cups/testipp.c.bug-3087	2005-01-03 14:29:45.000000000 -0500
++++ ./cups-1.1.23/cups/testipp.c	2012-05-15 11:01:04.815224520 -0400
+@@ -36,14 +36,38 @@
+ #include <stdlib.h>
+ #include <cups/string.h>
+ #include <errno.h>
+-#include "ipp.h"
++#include <cups/ipp.h>
+ #ifdef WIN32
+ #  include <io.h>
+ #else
+ #  include <unistd.h>
+ #  include <fcntl.h>
+ #endif /* WIN32 */
++#include <tet_api.h>
+ 
++/* file to read */
++const char ippfile[12] = "LSBTest.ipp";
++
++/* tet bits */
++void test_cleanup();
++void (*tet_startup)() = NULL;
++void (*tet_cleanup)() = test_cleanup;
++void test1();
++void test2();
++void test3();
++
++struct tet_testlist tet_testlist[] = 
++{ 
++    {test1,1},
++    {test2,2},
++    {test3,3},
++    {NULL,0} 
++};
++
++void test_cleanup()
++{
++
++}
+ 
+ /*
+  * Local globals...
+@@ -107,22 +131,15 @@ void	print_attributes(ipp_t *ipp, int in
+ int	read_cb(void *data, ipp_uchar_t *buffer, int bytes);
+ int	write_cb(void *data, ipp_uchar_t *buffer, int bytes);
+ 
+-
+-/*
+- * 'main()' - Main entry.
+- */
+-
+-int				/* O - Exit status */
+-main(int  argc,			/* I - Number of command-line arguments */
+-     char *argv[])		/* I - Command-line arguments */
++void test1()
+ {
+   ipp_t		*col;		/* Collection */
+   ipp_t		*request;	/* Request */
+   ipp_state_t	state;		/* State */
+   int		length;		/* Length of data */
+-  int		fd;		/* File descriptor */
+-  int		i;		/* Looping var */
+ 
++  tet_printf("Test %d", tet_thistest);
++  tet_infoline("Functional test for ippWriteIO");
+ 
+   request = ippNew();
+   request->request.op.version[0]   = 0x01;
+@@ -143,7 +160,7 @@ main(int  argc,			/* I - Number of comma
+ 
+   length = ippLength(request);
+   if (length != sizeof(collection))
+-    printf("ERROR ippLength didn't compute the correct length (%d instead of %d bytes!)\n",
++    tet_printf("ERROR ippLength didn't compute the correct length (%d instead of %d bytes!)",
+            length, sizeof(collection));
+ 
+   wused = 0;
+@@ -151,25 +168,42 @@ main(int  argc,			/* I - Number of comma
+     if (state == IPP_ERROR)
+       break;
+ 
+-  if (state != IPP_DATA)
+-    puts("ERROR writing collection attribute!");
++  if (state != IPP_DATA) {
++    tet_printf("ERROR writing collection attribute!");
++    tet_result(TET_FAIL);
++    return;
++  }
+ 
+-  printf("%d bytes written:\n", wused);
+-  hex_dump(wbuffer, wused);
++  tet_printf("%d bytes written..", wused);
+ 
+   if (wused != sizeof(collection))
+   {
+-    printf("ERROR expected %d bytes!\n", sizeof(collection));
+-    hex_dump(collection, sizeof(collection));
++    tet_printf("ERROR expected %d bytes!", sizeof(collection));
++    tet_result(TET_FAIL);
++    return;
+   }
+   else if (memcmp(wbuffer, collection, wused))
+   {
+-    puts("ERROR output does not match baseline!");
+-    hex_dump(collection, sizeof(collection));
++    tet_printf("ERROR output does not match baseline!");
++    tet_result(TET_FAIL);
++    return;
+   }
+-
++  
+   ippDelete(col);
+-  ippDelete(request);
++  // FIXME - this is in the original, hangs the tet-ified version
++  //ippDelete(request);
++
++  tet_result(TET_PASS);
++  return;
++}
++
++void test2()
++{
++  ipp_t		*request;	/* Request */
++  ipp_state_t	state;		/* State */
++
++  tet_printf("Test %d", tet_thistest);
++  tet_printf("Functional test for ippReadIO");
+ 
+   request = ippNew();
+   rpos    = 0;
+@@ -178,39 +212,51 @@ main(int  argc,			/* I - Number of comma
+     if (state == IPP_ERROR)
+       break;
+ 
+-  if (state != IPP_DATA)
+-    puts("ERROR reading collection attribute!");
++  if (state != IPP_DATA) {
++    tet_printf("ERROR reading collection attribute!");
++    tet_result(TET_FAIL);
++  } else {
++    tet_result(TET_PASS);
++  }
+ 
+-  printf("%d bytes read.\n", rpos);
++  tet_printf("%d bytes read.", rpos);
++  return;
++}
+ 
+-  puts("Core IPP tests passed.");
++void test3()
++{
++  ipp_t		*request;	/* Request */
++  ipp_state_t	state;		/* State */
++  int		fd;		/* File descriptor */
+ 
+-  for (i = 1; i < argc; i ++)
++  tet_printf("Test %d", tet_thistest);
++  tet_infoline("Functional test for ippReadFile");
++
++  /* FIXME - need to find a valid file for this to read */
++  tet_result(TET_UNTESTED);
++  return;
++
++  if ((fd = open(ippfile, O_RDONLY)) < 0)
+   {
+-    if ((fd = open(argv[i], O_RDONLY)) < 0)
+-    {
+-      printf("Unable to open \"%s\" - %s\n", argv[i], strerror(errno));
+-      continue;
+-    }
+-
+-    request = ippNew();
+-    while ((state = ippReadFile(fd, request)) == IPP_ATTRIBUTE);
+-
+-    if (state != IPP_DATA)
+-      printf("Error reading IPP message from \"%s\"!\n", argv[i]);
+-    else
+-    {
+-      printf("\n%s:\n", argv[i]);
+-      print_attributes(request, 4);
+-    }
++    tet_printf("Unable to open \"%s\" - %s", ippfile, strerror(errno));
++    tet_result(TET_UNRESOLVED);
++  }
++
++  request = ippNew();
++  while ((state = ippReadFile(fd, request)) == IPP_ATTRIBUTE);
+ 
+-    ippDelete(request);
+-    close(fd);
++  if (state != IPP_DATA) {
++    tet_printf("Error reading IPP message from \"%s\"!", ippfile);
++    tet_result(TET_FAIL);
++  } else {
++    tet_result(TET_PASS);
+   }
+ 
+-  return (0);
+-}
++  ippDelete(request);
++  close(fd);
++  return;
+ 
++}
+ 
+ /*
+  * 'hex_dump()' - Produce a hex dump of a buffer.

=== modified file 'scripts/package/lsb-test-printing.spec.sed'
--- a/scripts/package/lsb-test-printing.spec.sed	2011-06-03 13:53:09 +0000
+++ b/scripts/package/lsb-test-printing.spec.sed	2012-05-15 16:26:15 +0000
@@ -27,6 +27,7 @@
 Source3: hplip-%{hplipver}.tar.gz
 Patch0: cups-1.1.23-lsb-no-getpass.patch
 Patch1: hplip-2.8.12-lsbcc.patch
+Patch2: lsb-test-printing-add-ipp-tests.patch
 URL: http://www.linuxbase.org/test
 BuildRoot: %{_tmppath}/%{name}-root
 AutoReqProv: no
@@ -45,6 +46,7 @@
 cd hplip-%{hplipver}
 %patch1 -p0 -b .lsbcc
 cd ..
+%patch2 -p0 -b .bug-3087
 
 %build
 export LSBCC_BESTEFFORT=1
@@ -223,10 +225,12 @@
 echo "VSX_NAME=%{name} %{version}-%{rel} (%{tarch})" >> tetexec.cfg
 
 # and install
-for dir in convenience fhs ppd raster testgs testfoomaticrip results BIN LIB;do
+for dir in convenience fhs ipp ppd raster testgs testfoomaticrip results BIN LIB;do
   install -d ${RPM_BUILD_ROOT}%{troot}/$dir
 done
 install convenience/cupsConvenience ${RPM_BUILD_ROOT}%{troot}/convenience
+install cups-%{cupsver}/cups/testipp ${RPM_BUILD_ROOT}%{troot}/ipp
+install ipp/LSBTest.ipp ${RPM_BUILD_ROOT}%{troot}/ipp
 install ppd/cupsPPD ${RPM_BUILD_ROOT}%{troot}/ppd
 install raster/cupsRaster ${RPM_BUILD_ROOT}%{troot}/raster
 
@@ -293,6 +297,9 @@
 /opt/lsb/doc/%{name}/*
 
 %changelog
+* Mon May 14 2012 Stew Benedict <stewb at linux-foundation.org>
+- adapt cups tests for ippReadIO, ippWriteIO, ippReadFile (bug 3087, P2)
+ 
 * Fri Jun 03 2011 Stew Benedict <stewb at linux-foundation.org>
 - newer systems use .cups/client.conf instead of .cupsrc to get a 
   custom port, add a symlink for this (bug 3256)

=== added directory 'sources/printing-test/ipp'
=== added file 'sources/printing-test/ipp/LSBTest.ipp'
Binary files a/sources/printing-test/ipp/LSBTest.ipp	1970-01-01 00:00:00 +0000 and b/sources/printing-test/ipp/LSBTest.ipp	2012-05-15 16:26:15 +0000 differ
=== modified file 'sources/printing-test/tet_scen'
--- a/sources/printing-test/tet_scen	2008-11-14 17:29:02 +0000
+++ b/sources/printing-test/tet_scen	2012-05-15 16:26:15 +0000
@@ -12,3 +12,5 @@
         /testfoomaticrip/testfoomaticrip
 	"total tests in printing-fhs 1"
 	/fhs/share-ppd/share-ppd
+	"total tests in testipp 3"
+	/ipp/testipp



More information about the lsb-messages mailing list