Nmap Development mailing list archives

Re: Nsock test suite


From: David Fifield <david () bamsoftware com>
Date: Fri, 10 May 2013 16:16:34 -0700

On Wed, May 08, 2013 at 01:48:04PM +0200, Henri Doreau wrote:
I've added a minimal regression test suite for nsock in nsock/tests in r30872.

The entry point is the run_tests.sh shell script. You have to build
the modules (using make), and call the script. It takes optional
parameters to run the tests in gdb, strace or valgrind. The timer
module is based on fyodor's nsock_test_timers.c example.

e.g.:
  $ cd nsock/tests
  $ make
  $ ./run_tests.sh [gdb|trace|leak]
  [OK] nsock pool user data
  [OK] test timer operations

The first time I tried to build it, I got an error because the
--libpcap=included wasn't noticed in the makefile. I think the examples
directory has this problem too.

nsock/tests$ make
gcc -c -Wall -O0 -ggdb -I../include/ -I../../nbase tests_main.c -o tests_main.o
gcc -c -Wall -O0 -ggdb -I../include/ -I../../nbase basic.c -o basic.o
gcc -c -Wall -O0 -ggdb -I../include/ -I../../nbase timer.c -o timer.o
gcc -c -Wall -O0 -ggdb -I../include/ -I../../nbase logs.c -o logs.o
gcc -c -Wall -O0 -ggdb -I../include/ -I../../nbase connect.c -o connect.o
gcc -lssl -lpcap -lcrypto tests_main.o basic.o timer.o logs.o connect.o -o tests_main ../src/libnsock.a 
../../nbase/libnbase.a
/usr/bin/ld: cannot find -lpcap
collect2: error: ld returned 1 exit status
make: *** [tests_main] Error 1

After I installed libpcap-dev, these are my results.

nsock/tests$ ./tests_main
[OK] nsock pool user data
[OK] test timer operations
[OK] set standard log levels
[OK] check error log levels
(connect.c:67) Assertion failed: (ctd->connect_result) == (NSE_STATUS_SUCCESS)
[FAILED] simple tcp connection (Invalid argument)

David
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: