tinc/test/cmocka-simple.sh
thorkill 4b6e956a2d Added first version of cmocka based unittest
To compile the test you will need cmocka installed on system.
Checks in configure.ac are still missing.

$ cd tinc/test/; make simple
to generate testing directory you can use cmocka-simple.sh
$ ./cmocka-simple.sh
‘mocks/conf1’ -> ‘/tmp/tmp.PtS9r796ns/conf1’
To run the test do: cd /tmp/tmp.PtS9r796ns ; ./simple

$ ./simple
[==========] Running 6 test(s).
[ RUN      ] test_edge_init
0 != 0x2
simple.c:73: error: Failure!

[  FAILED  ] test_edge_init
[ RUN      ] test_read_config_file
[       OK ] test_read_config_file
[ RUN      ] test_config_add_item
[       OK ] test_config_add_item
[ RUN      ] test_config_add_item_no_filename
value
simple.c:234: error: Failure!

[  FAILED  ] test_config_add_item_no_filename
[ RUN      ] test_splay_tree_init
[       OK ] test_splay_tree_init
[ RUN      ] test_splay_tree_basic
[       OK ] test_splay_tree_basic
[==========] 6 test(s) run.
[  PASSED  ] 4 test(s).
[  FAILED  ] 2 test(s), listed below:
[  FAILED  ] test_edge_init
[  FAILED  ] test_config_add_item_no_filename

 2 FAILED TEST(S)
2015-07-01 19:46:28 +02:00

9 lines
140 B
Bash
Executable file

#!/bin/sh
TEST_DIR=`mktemp -d`
cp -v mocks/conf1 $TEST_DIR
cp .libs/simple $TEST_DIR
echo "To run the test do: cd $TEST_DIR ; ./simple"