[sane-devel] Test application
stef
stef.dev at free.fr
Fri Mar 26 13:42:39 UTC 2010
Le vendredi 26 mars 2010 13:47:17 Yevgeny Gromov, vous avez écrit :
> Hi!
> It's recommended to write a test application while implementing support for
> new hardware in SANE, because it's much easier to debug then library.
> Can anyone give a link to such application?
>
> And how can I force sane applications to use libraries in /usr/local
> (modified) instead of system ones?
>
> --
> sane-devel mailing list: sane-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/sane-devel
> Unsubscribe: Send mail with subject "unsubscribe your_password"
> to sane-devel-request at lists.alioth.debian.org
>
Hello,
you don't need to install to test. When developing in compile then run from
within the backend directory with a script like:
#!/bin/bash
export SANE_DEBUG_GENESYS=255
export SANE_DEBUG_GENESYS_GL841=255
export LD_PRELOAD=.libs/libsane-genesys.so
../frontend/scanimage -d genesys --resolution 150 --mode Color 2>run.log
>scan.pnm
The important point is the LD_PRELOAD export that ensure that your latest
code is ran (here the genesys backend shared lib, you'll need to change it).
You can also debug like this, but don't forget to change the debugging flags
from '-g -O2' to '-ggdb' in the Makefile.
When doing unit testing, I often compile a static test program with a
makefile like this:
all: hp
.c.o:
gcc -DUNIT_TESTING -DBACKEND_NAME=unit_testing -ggdb -I../include -c $<
hp: hp3670.o .libs/libgenesys.a
gcc -ggdb -o hp hp3670.o .libs/libgenesys.a .libs/sane_strstatus.o -L.libs -
L../sanei/.libs -L../lib/.libs -lgenesys -lsanei -llib -lusb-1.0 -lm
Where I have a hp3670.c file calling the functions I want to test. The
UNIT_TESTING define is used in the genesys backend to turn private functions
(to stick with the SANE standard) into public one that can be used by the test
prog.
Regards,
Stef
More information about the sane-devel
mailing list