From 297ece114a581158ca5e523615f04742fa1d064d Mon Sep 17 00:00:00 2001 From: Kaian Date: Sun, 5 Jul 2015 16:19:22 +0200 Subject: [PATCH] Add basic Testing files --- .gitignore | 8 +++-- Makefile.am | 2 +- configure.ac | 1 + tests/Makefile.am | 10 ++++++ tests/README | 16 +++++++++ tests/aaa.pcap | Bin 0 -> 111077 bytes tests/test_001.c | 36 ++++++++++++++++++++ tests/test_002.c | 66 +++++++++++++++++++++++++++++++++++++ tests/test_003.c | 74 +++++++++++++++++++++++++++++++++++++++++ tests/test_004.c | 65 ++++++++++++++++++++++++++++++++++++ tests/test_005.c | 63 +++++++++++++++++++++++++++++++++++ tests/test_006.c | 43 ++++++++++++++++++++++++ tests/test_007.c | 79 ++++++++++++++++++++++++++++++++++++++++++++ tests/test_input.c | 80 +++++++++++++++++++++++++++++++++++++++++++++ 14 files changed, 540 insertions(+), 3 deletions(-) create mode 100644 tests/Makefile.am create mode 100644 tests/README create mode 100644 tests/aaa.pcap create mode 100644 tests/test_001.c create mode 100644 tests/test_002.c create mode 100644 tests/test_003.c create mode 100644 tests/test_004.c create mode 100644 tests/test_005.c create mode 100644 tests/test_006.c create mode 100644 tests/test_007.c create mode 100644 tests/test_input.c diff --git a/.gitignore b/.gitignore index 11cccdf..422d0ae 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,11 @@ # Build files src/sngrep -src/*.o -src/.deps +tests/test-*.log +tests/test-*.trs +tests/test-??? +*/*.o +*/.deps src/config.h* src/stamp-h1 @@ -22,6 +25,7 @@ configure missing install-sh depcomp +test-driver # Ignore Doxygen generated files doc/html diff --git a/Makefile.am b/Makefile.am index 215c0a1..b0dd2a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,2 +1,2 @@ -SUBDIRS=src config doc +SUBDIRS=src config doc tests EXTRA_DIST=bootstrap.sh diff --git a/configure.ac b/configure.ac index bb1e5fb..9bc48bc 100644 --- a/configure.ac +++ b/configure.ac @@ -198,4 +198,5 @@ AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([config/Makefile]) AC_CONFIG_FILES([doc/Makefile]) +AC_CONFIG_FILES([tests/Makefile]) AC_OUTPUT diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..affa206 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,10 @@ +check_PROGRAMS=test-001 test-002 test-003 test-004 test-005 test-006 test-007 +test_001_SOURCES=test_001.c +test_002_SOURCES=test_002.c +test_003_SOURCES=test_003.c +test_004_SOURCES=test_004.c +test_005_SOURCES=test_005.c +test_006_SOURCES=test_006.c +test_007_SOURCES=test_007.c ../src/vector.c + +TESTS = $(check_PROGRAMS) \ No newline at end of file diff --git a/tests/README b/tests/README new file mode 100644 index 0000000..97dd0f9 --- /dev/null +++ b/tests/README @@ -0,0 +1,16 @@ +Basic testing programs for sngrep. + +This set of test will do some basic inputs to check sngrep screen navigation +doesn't crash. This checks are ultra-super-basic. + +- test_001 : UI testing +- test_002 : Call List testing +- test_003 : Call Flow testing +- test_004 : Call Raw testing +- test_005 : Column selection testing +- test_006 : Message diff testing +- test_007: Test vector container structures + +Sample capture files has been taken from wireshark Wiki: +- https://wiki.wireshark.org/SampleCaptures + diff --git a/tests/aaa.pcap b/tests/aaa.pcap new file mode 100644 index 0000000000000000000000000000000000000000..6e47833bd955ade1642a82e8966c43bcf2da8c6a GIT binary patch literal 111077 zcmeI52S5}@_rUj#qMV?hqNb>;DW(AK?R69*3KB$x2zC?QyW4|?Y zq!&|6)%0jgvwcRB7!!@L7h-QQM&tjzx!dD7V7$Aos^2KaFq$v8dDU-@D1MH75Ol3^J70X{y zDB-!lJP3ahN4z&>pCXzh0dKLXeNt0W`}WC7O-;>89gx~9wQp)>?_}vuum126MsWkM zW*=!vV?9b(%jL6f1lHN>!f33=2d6*pd|3ARfge=qA3#|3MEC#6lw4g z_=4{g_~wET71JI5jgRXy441=b2RD`8RJ#6+pRY;d0c#9%+Q6umcZ#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CnQvE*8Y_3s8=IOQj?cN^3cktw7oQ1C`Q) zP+G~MYy*m!dQ^xbjZjo_C_91D>kq0dw-ZW)97;7%63?q>gI_wKM0zMqaqw&VdKB0V zQti{0zL9WaNML*N;TX-dvt6Q^RmvIs5L^ZaL%_W< z0_(c@REY)<@$8-^c^XCU{h`2D~4e@d49DY+=i~N zPS7!gkXEi_cxGh(6UKx@GfWG`pvBBN zD1zs{3#HlpIXZG7j)n^(%Q`w={JODJWB ztz!_1)`r~SE!q8^v$&czg<#+~+BH!QII9*^@Gp-FHp7lL<-t9i{~d1xP%^0Z**S&~ z3fZa$Bt^3zD9wQK!gW+xh7!u3a%71D%B}<|Wf-BHkwb|A%HUKgWjLYyA%}7mP%`_6 z(b~lbpL&VJcCo**JMUk+K*E6Ru)x|yB$KxKTz6hpyFhT)p<%RkF%m^iLa-VNOGtH$@tM$e)s-blkVI6VTwG7s^z&Z;jZi4LOsWTW1 zaEv0X!}3`-0PEvds5(3vS$&UrbT|t8mSI!A)A--F+z6DbXHzKxp-45QXch$JCZOE0 zh)OXNid08IQEmZB*=tmag;1p035pU2lzsOo7_g|xOA??I6YT6=6`?ROd{Z2ap((b&1S~@n8_V1pwgQ)4QK>27A zRRY-X3R-*8L-AVz4$_Wk*@S_fjXb{dYo-L}*F9sFb%C^r8O`XLHD~S`-L1cFawXUy z3P#B=^_M)Hz(LOGP{c8zWOg16pT+8mW5Pp9iyjIRWW+C;b%unQ>4BY5(5wZM_WUV} zz7h$9K_fJ9{t1HL9}rF(h3qJrX9b;jWj)qeFL=G}0@@i74p;>TUEJj. + ** + ****************************************************************************/ +/** + * @file test_001.c + * @author Ivan Alonso [aka Kaian] + * + * Basic read from file test + */ + +const char keys[] = + { + 27, + 10, + 0 + }; + +#include "test_input.c" diff --git a/tests/test_002.c b/tests/test_002.c new file mode 100644 index 0000000..847a933 --- /dev/null +++ b/tests/test_002.c @@ -0,0 +1,66 @@ +/************************************************************************** + ** + ** sngrep - SIP Messages flow viewer + ** + ** Copyright (C) 2015 Ivan Alonso (Kaian) + ** Copyright (C) 2015 Irontec SL. All rights reserved. + ** + ** This program is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** This program is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with this program. If not, see . + ** + ****************************************************************************/ +/** + * @file test_002.c + * @author Ivan Alonso [aka Kaian] + * + * Basic Call list testing + */ + +const char keys[] = + { + /* Swap some options */ + 'c', 'l', 'p', 'p', + /* Select some dialogs */ + 107, 32, 107, 107, 32, 107, 107, 107, 32, 107, 107, + /* Enter Call Flow */ + 10, 27, + /* Enter Call Raw */ + 'R', 27, + /* Enter Filter screen */ + 'F', 27, + /* Enter Column screen */ + 't', 27, + /* Unselect some dialogs */ + 32, 107, 32, + /* Move beyond list limits */ + 107, 107, 107, 107, 107, 106, + 107, 107, 107, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 4, 4, 2, 2, 4, 2, 4, 2, + /* Enter help screen */ + 'h', 100, + /* Enter save screen */ + 's', 20, 30, 40, 50, 27, + /* Enter display filter */ + '/', 20, 30, 40, 40, 10, + '/', 27, + /* Enter Call Flow once again */ + 10, 27, + /* Exit */ + 27, + 10, + 0 + }; + +#include "test_input.c" diff --git a/tests/test_003.c b/tests/test_003.c new file mode 100644 index 0000000..89e7dda --- /dev/null +++ b/tests/test_003.c @@ -0,0 +1,74 @@ +/************************************************************************** + ** + ** sngrep - SIP Messages flow viewer + ** + ** Copyright (C) 2015 Ivan Alonso (Kaian) + ** Copyright (C) 2015 Irontec SL. All rights reserved. + ** + ** This program is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** This program is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with this program. If not, see . + ** + ****************************************************************************/ +/** + * @file test_003.c + * @author Ivan Alonso [aka Kaian] + * + * Basic Call Flow testing + */ + +const char keys[] = + { + /* Select some dialogs */ + 32, 107, 32, 107, + /* Enter Call Flow */ + 10, 27, + /* Move arrow messages */ + 107, 107, 107, 107, 107, 106, + 107, 107, 107, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 4, 4, 2, 2, 4, 2, 4, 2, + /* Reenter Call Flow */ + 10, + /* Swap colors */ + 'c', 'c', 'c', 'c', 'c', 'c', + /* Enter Extended Call Flow */ + 'x', 'x', 'x', 'x', + /* Compress column display */ + 's', + /* Toggle media display */ + 'd', 'd', 'd', 'd', 'd', + /* Toggle Only SDP */ + 'D', + /* Enter Call Raw (all dialogs) */ + 'R', 27, + /* Enter Call Raw (single message) */ + 10, 27, + /* Enter help screen */ + 'h', 100, + /* Toggle raw screen */ + 't', 't', 't', 't', + /* Change Raw size */ + '0', '0', '0', '0', '0', '0', '0', '0', + '9', '9', '9', '9', '9', '9', '9', '9', + /* Reset Raw size */ + 'T', 'T', + /* Leave Call Flow */ + 27, + /* Exit */ + 27, + 10, + 0 + }; + +#include "test_input.c" diff --git a/tests/test_004.c b/tests/test_004.c new file mode 100644 index 0000000..f71a8aa --- /dev/null +++ b/tests/test_004.c @@ -0,0 +1,65 @@ +/************************************************************************** + ** + ** sngrep - SIP Messages flow viewer + ** + ** Copyright (C) 2015 Ivan Alonso (Kaian) + ** Copyright (C) 2015 Irontec SL. All rights reserved. + ** + ** This program is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** This program is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with this program. If not, see . + ** + ****************************************************************************/ +/** + * @file test_004.c + * @author Ivan Alonso [aka Kaian] + * + * Basic Call Raw testing + */ +const int keys[] = + { + /* Select some dialogs */ + 32, 107, 107, 107, 32, 107, + /* Show Raw panel */ + 'r', + /* Cicle options */ + 'c', 'c', 'c', 'c', 'c', 'c', + 'a', 'a', 'a', 'a', 'a', 'a', + 'l', 'l', 'l', 'C', 'C', 'C', + /* Move through Raw panel */ + 107, 107, 107, 107, 107, 106, + 107, 107, 107, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 4, 4, 2, 2, 4, 2, 4, 2, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + /* Enter save screen */ + 's', 20, 30, 40, 50, 60, 27, + /* Leave call Raw */ + 27, + /* Exit */ + 27, + 10, + 0 + }; + +#include "test_input.c" diff --git a/tests/test_005.c b/tests/test_005.c new file mode 100644 index 0000000..b3c3b58 --- /dev/null +++ b/tests/test_005.c @@ -0,0 +1,63 @@ +/************************************************************************** + ** + ** sngrep - SIP Messages flow viewer + ** + ** Copyright (C) 2015 Ivan Alonso (Kaian) + ** Copyright (C) 2015 Irontec SL. All rights reserved. + ** + ** This program is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** This program is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with this program. If not, see . + ** + ****************************************************************************/ +/** + * @file test_005.c + * @author Ivan Alonso [aka Kaian] + * + * Basic Column selection testing + */ + +const int keys[] = + { + /* Show Raw panel */ + 't', + /* Cycle through fields */ + 9, 9, 9, 9, 9, 9, + 9, 107, 107, 9, 106, + /* Move through Column list */ + 107, 107, 107, 107, 107, 106, + 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, + 107, 107, 107, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, + /* Move items up and down */ + '-', '-', '-', '-', + 107, 107, + '+', '+', '+', '+', + 107, 107, + '-', '-', '-', '-', + /* Apply new settings */ + 10, + /* Exit */ + 27, + 10, + 0 + }; + +#include "test_input.c" diff --git a/tests/test_006.c b/tests/test_006.c new file mode 100644 index 0000000..23a3825 --- /dev/null +++ b/tests/test_006.c @@ -0,0 +1,43 @@ +/************************************************************************** + ** + ** sngrep - SIP Messages flow viewer + ** + ** Copyright (C) 2015 Ivan Alonso (Kaian) + ** Copyright (C) 2015 Irontec SL. All rights reserved. + ** + ** This program is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** This program is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with this program. If not, see . + ** + ****************************************************************************/ +/** + * @file test_006.c + * @author Ivan Alonso [aka Kaian] + * + * Basic Message diff testing + */ +const int keys[] = + { + /* Select some dialog */ + 107, 107, 107, 32, 10, + /* Move Select some messages */ + 107, 107, 32, 32, 107, 32, + 107, 107, 107, 106, 32, + /* Leave Diff screen */ + 27, 27, + /* Exit */ + 27, + 10, + 0 + }; + +#include "test_input.c" diff --git a/tests/test_007.c b/tests/test_007.c new file mode 100644 index 0000000..09309c0 --- /dev/null +++ b/tests/test_007.c @@ -0,0 +1,79 @@ +/************************************************************************** + ** + ** sngrep - SIP Messages flow viewer + ** + ** Copyright (C) 2015 Ivan Alonso (Kaian) + ** Copyright (C) 2015 Irontec SL. All rights reserved. + ** + ** This program is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** This program is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with this program. If not, see . + ** + ****************************************************************************/ +/** + * @file test_vector.c + * @author Ivan Alonso [aka Kaian] + * + * Basic testing of vector structures + */ + +#include "config.h" +#include +#include +#include "vector.h" + +int main () +{ + vector_t *vector; + + // Basic Vector append/remove test + vector = vector_create(10, 10); + assert(vector); + assert(vector_count(vector) == 0); + vector_append(vector, 0); + assert(vector_count(vector) == 0); + vector_append(vector, malloc(1024)); + assert(vector_count(vector) == 1); + assert(vector_first(vector) == vector_item(vector, 0)); + vector_remove(vector, vector_first(vector)); + assert(vector_count(vector) == 0); + assert(vector_first(vector) == vector_item(vector, 0)); + + // Vector overflow test + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + // Next append requires memory reallocation + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + vector_append(vector, malloc(32)); + // Expected vector size + assert(vector_count(vector) == 16); + // Expected empty position + assert(vector_item(vector, vector_count(vector)) == 0); + // Remove position (use generic destroyer) + vector_set_destroyer(vector, vector_generic_destroyer); + vector_remove(vector, vector_item(vector, 12)); + assert(vector_count(vector) == 15); + + return 0; +} diff --git a/tests/test_input.c b/tests/test_input.c new file mode 100644 index 0000000..2de35ac --- /dev/null +++ b/tests/test_input.c @@ -0,0 +1,80 @@ +/************************************************************************** + ** + ** sngrep - SIP Messages flow viewer + ** + ** Copyright (C) 2015 Ivan Alonso (Kaian) + ** Copyright (C) 2015 Irontec SL. All rights reserved. + ** + ** This program is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** This program is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with this program. If not, see . + ** + ****************************************************************************/ +/** + * @file test_input.c + * @author Ivan Alonso [aka Kaian] + * + * Basic input injector for sngrep testing + */ + +#include +#include +#include +#include + +#ifndef TEST_MAX_DURATION +#define TEST_MAX_DURATION 5 +#endif + +#ifndef TEST_INITIAL_WAIT +#define TEST_INITIAL_WAIT 1000 * 600 +#endif + +#ifndef TEST_KEY_DELAY +#define TEST_KEY_DELAY 1000 +#endif + +#ifndef TEST_PCAP_INPUT +#define TEST_PCAP_INPUT "aaa.pcap" +#endif + +int +main() +{ + int ppipe[2]; + int unused, ret; + unused = pipe(ppipe); + + // Max test duration + alarm(TEST_MAX_DURATION); + + if (!fork()) { + char *argv[] = + { + "../src/sngrep", + "-I", + TEST_PCAP_INPUT, + 0 }; + dup2(ppipe[0], STDIN_FILENO); + execv(argv[0], argv); + } else { + usleep(TEST_INITIAL_WAIT); + int i; + for (i = 0; keys[i]; i++) { + unused = write(ppipe[1], &keys[i], sizeof(char)); + usleep(TEST_KEY_DELAY); + } + unused = wait(&ret); + } + + return ret; +}