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)
This commit is contained in:
thorkill 2015-07-01 19:46:28 +02:00
parent 536256b2da
commit 4b6e956a2d
3 changed files with 276 additions and 0 deletions

6
test/mocks/conf1 Normal file
View file

@ -0,0 +1,6 @@
# mock test 1 config
Subnet = 127.0.0.1/24
Subnet = fd06:4c12:61a3:2:0:0:0:0/64
Ed25519PublicKey = Joidie1huashaitu1shie2aesi5Eegie3ahZ8Jah4a1