[sane-devel] [PATCH] [RFC] add sanei_usb test program

2013-03-19 Thread Stef
On 18/03/2013 15:31, Paul Menzel wrote:
 Dear Stef,


 sorry that it took me so long to reply.


 Am Samstag, den 16.03.2013, 11:11 +0100 schrieb Stef:

 [?]


 Hello,

 this patch has been superseded by the last one of the patches 
posted later in another mail thread. However, thanks for the time 
reviewing it, a couple of typos are still relevant, and I'll run 
'indent' on the test program.

Regards,
 Stef



[sane-devel] [PATCH] [RFC] add sanei_usb test program

2013-03-18 Thread Paul Menzel
Dear Stef,


sorry that it took me so long to reply.


Am Samstag, den 16.03.2013, 11:11 +0100 schrieb Stef:

[?]

 it is a handy format that ease the review process. I'll consider it 
 for another occasion if there is a consensus on receiving sometimes 
 about 12 mails and on raising the mail size limit (one of the patches is 
 ~40k if inlined).
 For this time I'd appreciate that you comment on the patches with their 
 current form.

I edited the patch right away. You can save this message and apply it
with `git am --scissors patch/to/file`.

Some typos, grammar, return value comments and coding style [1] is
hopefully improved. Here is the diff.

$ git diff stefs-patch stefs-patch-my  /tmp/git-diff-stef-and-my-changes.diff
diff --git a/testsuite/sanei/Makefile.am b/testsuite/sanei/Makefile.am
index a05108e..49c1a97 100644
--- a/testsuite/sanei/Makefile.am
+++ b/testsuite/sanei/Makefile.am
@@ -1,11 +1,11 @@
 ##  Makefile.am -- an automake template for Makefile.in file
 ##  Copyright (C) 2009 Chris Bagwell and Sane Developers.
 ##
-##  This file is part of the Sane build infra-structure.  See
+##  This file is part of the Sane build infrastructure.  See
 ##  included LICENSE file for license information.
 
-MATH_LIB = @MATH_LIB@ 
-USB_LIBS = @USB_LIBS@ 
+MATH_LIB = @MATH_LIB@
+USB_LIBS = @USB_LIBS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
 
 EXTRA_PROGRAMS = sanei_usb_test
@@ -19,7 +19,7 @@ clean-local:
rm -f sanei_usb_test
 
 all:
-   @echo 'run make tests' to run tests
+   @echo run 'make tests' to run tests
 
 tests: $(EXTRA_PROGRAMS)
sanei_usb_test
diff --git a/testsuite/sanei/Makefile.in b/testsuite/sanei/Makefile.in
index ab92780..379ce69 100644
--- a/testsuite/sanei/Makefile.in
+++ b/testsuite/sanei/Makefile.in
@@ -162,7 +162,7 @@ MAINT = @MAINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
-MATH_LIB = @MATH_LIB@ 
+MATH_LIB = @MATH_LIB@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
 MSGMERGE = @MSGMERGE@
@@ -202,7 +202,7 @@ STRIP = @STRIP@
 SYSLOG_LIBS = @SYSLOG_LIBS@
 SYSTEMD_LIBS = @SYSTEMD_LIBS@
 TIFF_LIBS = @TIFF_LIBS@
-USB_LIBS = @USB_LIBS@ 
+USB_LIBS = @USB_LIBS@
 VERSION = @VERSION@
 V_MAJOR = @V_MAJOR@
 V_MINOR = @V_MINOR@
@@ -300,7 +300,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ 
$(am__configure_deps)
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir)  $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-sanei_usb_test$(EXEEXT): $(sanei_usb_test_OBJECTS) 
$(sanei_usb_test_DEPENDENCIES) $(EXTRA_sanei_usb_test_DEPENDENCIES) 
+sanei_usb_test$(EXEEXT): $(sanei_usb_test_OBJECTS) 
$(sanei_usb_test_DEPENDENCIES) $(EXTRA_sanei_usb_test_DEPENDENCIES)
@rm -f sanei_usb_test$(EXEEXT)
$(LINK) $(sanei_usb_test_OBJECTS) $(sanei_usb_test_LDADD) $(LIBS)
 
diff --git a/testsuite/sanei/README b/testsuite/sanei/README
index fba421e..7b8af5b 100644
--- a/testsuite/sanei/README
+++ b/testsuite/sanei/README
@@ -1,8 +1,8 @@
 SANEI test suite
 ===
-St\E9phane Voltz stef.dev at free.fr
+St?phane Voltz stef.dev at free.fr
 
-This directory contains tests programs for sanei functions. They are compiled 
+This directory contains test programs for sanei functions. They are compiled
 and run by 'make tests'.
 
 sanei_usb tested functions, at least one USB scanner needs to be plugged:
diff --git a/testsuite/sanei/sanei_usb_test.c b/testsuite/sanei/sanei_usb_test.c
index 8cd45dd..d7541f7 100644
--- a/testsuite/sanei/sanei_usb_test.c
+++ b/testsuite/sanei/sanei_usb_test.c
@@ -30,7 +30,7 @@
 #include ../../include/_stdint.h
 
 /*
- * In order to avoid modifying sanei_usb.c to allow for unit tests
+ * In order to avoid modifying sanei_usb.c to be suitable for unit tests
  * we include it so we can use its private variables and structures
  * and still test the code.
  */
@@ -40,102 +40,102 @@
 /** test sanei_usb_init()
  * calls sanei_usb_init
  * @param expected expected use count
- * @return 0 on success, else 1
+ * @return 0 on success, else 1 or 2
  */
-static int test_init(int expected)
+static int test_init (int expected)
 {
   /* initialize USB */
-  printf(%s starting ...\n, __FUNCTION__);
+  printf (%s starting ...\n, __FUNCTION__);
   sanei_usb_init ();
-  if (initialized==0)
+  if (initialized == 0)
 {
-  printf(ERROR: sanei_usb not initialized!\n);
+  printf (ERROR: sanei_usb not initialized!\n);
   return 1;
 }
   if (initialized != expected)
 {
-  printf(ERROR: incorrect use count, expected %d, got %d!\n,expected, 
initialized);
+  printf (ERROR: incorrect use count, expected %d, got %d!\n, expected, 
initialized);
   return 2;
 }
-  
-  printf(sanei_usb initialized, use count is %d ...\n, initialized);
-  printf(%s success\n\n, __FUNCTION__);
+
+  printf (sanei_usb initialized, use count is %d ...\n, initialized);
+  printf (%s success\n\n, __FUNCTION__);
   return 0;
 }
 
 /** test sanei_usb_exit()
  * calls sanei_usb_exit
  * @param 

[sane-devel] [PATCH] [RFC] add sanei_usb test program

2013-03-16 Thread Stef
On 14/03/2013 16:23, Paul Menzel wrote:
 Dear Stef,


 Am Freitag, den 08.03.2013, 21:55 +0100 schrieb Stef:

 [?]

   I really think this test program should be added, it doesn't add
 extra dependency and helps testing a lot. For instance while adding a
 test case for the problem Olaf spotted (not setting usb context to
 null), it allowed me to find I also forgot to reset device_number to 0
 in sane_exit().
 I agree with your reasoning.

 I think I spotted some small things. Could you please resend the patch
 inlined, so I can answer inline with my email client? That would be
 awesome.

 You can do

  $ git format-patch -1

 as you already did and copy that to the commit message body and make
 sure to turn of automatic line wrapping in Thunderbird.


 Thanks,

 Paul
 Hello,

it is a handy format that ease the review process. I'll consider it 
for another occasion if there is a consensus on receiving sometimes 
about 12 mails and on raising the mail size limit (one of the patches is 
~40k if inlined).
For this time I'd appreciate that you comment on the patches with their 
current form.

Thanks,
 Stef



[sane-devel] [PATCH] [RFC] add sanei_usb test program

2013-03-14 Thread Paul Menzel
Dear Stef,


Am Freitag, den 08.03.2013, 21:55 +0100 schrieb Stef:

[?]

  I really think this test program should be added, it doesn't add 
 extra dependency and helps testing a lot. For instance while adding a 
 test case for the problem Olaf spotted (not setting usb context to 
 null), it allowed me to find I also forgot to reset device_number to 0 
 in sane_exit().

I agree with your reasoning.

I think I spotted some small things. Could you please resend the patch
inlined, so I can answer inline with my email client? That would be
awesome.

You can do

$ git format-patch -1

as you already did and copy that to the commit message body and make
sure to turn of automatic line wrapping in Thunderbird.


Thanks,

Paul
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20130314/705487e8/attachment.pgp


[sane-devel] [PATCH] [RFC] add sanei_usb test program

2013-03-13 Thread Olaf Meeuwissen
Stef writes:

 On 06/03/2013 22:22, Stef wrote:
 [... details about the test program ...]
  I really think this test program should be added, it doesn't add 
 extra dependency and helps testing a lot. For instance while adding a 
 test case for the problem Olaf spotted (not setting usb context to 
 null), it allowed me to find I also forgot to reset device_number to 0 
 in sane_exit().

As I already/just mentioned in my review, I'm in favour of adding
tests.  If they are run as part of `make check` that's even better.

# And shame on me for not spotting the missing device_number reset!
# I'd probably have written that as a count-down loop on device_number
# so the reset becomes part of the resource release logic.  Anyways.

Hope this helps,
-- 
Olaf Meeuwissen, LPIC-2   FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962   Help support software freedom
 http://www.fsf.org/jf?referrer=1962



[sane-devel] [PATCH] [RFC] add sanei_usb test program

2013-03-06 Thread Stef
 Hello,

 here is a patch that adds a sanei_usb_test program in a new 
testsuite/sanei directory. This program tests these sanei_usb functions:
 - sanei_usb_init()
 - sanei_usb_open()
 - sanei_usb_get_vendor_product_byname()
 - sanei_usb_close()
 - sanei_usb_exit()

It is compiled and run only when 'make tests' is ran in the new 
subdirectory. It needs at least one USB scanner plugged. I'm using it to 
check the changes I am currently doing in sanei_usb.c .
 In the long term, I may even add use of umockdev (linux only) to 
tests more things without need for actual scanner devices.

Regards,
 Stef



[sane-devel] [PATCH] [RFC] add sanei_usb test program

2013-03-06 Thread Stef
On 06/03/2013 22:21, Stef wrote:
 Hello,

 here is a patch that adds a sanei_usb_test program in a new 
 testsuite/sanei directory. This program tests these sanei_usb functions:
 - sanei_usb_init()
 - sanei_usb_open()
 - sanei_usb_get_vendor_product_byname()
 - sanei_usb_close()
 - sanei_usb_exit()

 It is compiled and run only when 'make tests' is ran in the new 
 subdirectory. It needs at least one USB scanner plugged. I'm using it 
 to check the changes I am currently doing in sanei_usb.c .
 In the long term, I may even add use of umockdev (linux only) to 
 tests more things without need for actual scanner devices.

 Regards,
 Stef

 Oops,

 with attachment this time!

regards,
 Stef
-- next part --
A non-text attachment was scrubbed...
Name: 0001-add-test-program-for-sanei_usb.patch.gz
Type: application/x-gzip
Size: 8134 bytes
Desc: not available
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20130306/91a2d655/attachment.bin