Framework for non-interactive mesh test
Subsystems (2)
v4 cover Framework for non-interactive mesh test
v4: Use tester frameworks from ELL library
**********
v3: Fixed copyright style in mesh-io-unit.h
**********
v2: Fixed errors reported by bluez-bot.
Regarding the warnings for the "__attribute__((packed))":
keeping this style to be consistent with the rest of BLueZ codebase
**********
This patch set introduces a framework for non-interactive testing of mesh daemon functionality and consists of the three components:
1. A version of src/shared/tester that uses ELL primitives:
everything mesh-related uses ELL.
2. New type of mesh IO used only for testing.
3. The mesh-cfgtest tool that excercises a number of mesh D-Bus API calls. Currently, the tool covers limited number of initial test cases. The extended coverage will be provided after this patch set is accepted.
Brian Gix (1):
mesh: Add unit test IO
Inga Stotland (1):
tools/mesh-cfgtest: Non-iteractive test for mesh
Makefile.am | 14 +- Makefile.mesh | 2 + Makefile.tools | 6 + mesh/main.c | 51 +- mesh/mesh-io-unit.c | 533 +++++++++++++++ mesh/mesh-io-unit.h | 11 + mesh/mesh-io.c | 9 +- mesh/mesh-io.h | 3 +- tools/mesh-cfgtest.c | 1458 ++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 2065 insertions(+), 22 deletions(-) create mode 100644 mesh/mesh-io-unit.c create mode 100644 mesh/mesh-io-unit.h create mode 100644 tools/mesh-cfgtest.c
Signature · 1 line
2.26.2
PATCH v4 1/2 mesh: Add unit test IO
From: Brian Gix <[email protected]>
This adds a new type of mesh IO that is used for non-interactive testing. The new io option can be specified on command line as:
--io unit:<socket_name>
When the bluetooth-meshd daemon starts with the "unit" IO type, the daemon opens a socket (fd to open is provided after "unit:" in <socket_name>). The communication with the daemon is done either through the loop-back using mesh DBus-based APIs or the specified named socket.
--- Makefile.mesh | 2 + mesh/main.c | 41 +++- mesh/mesh-io-unit.c | 533 ++++++++++++++++++++++++++++++++++++++++++++ mesh/mesh-io-unit.h | 11 + mesh/mesh-io.c | 9 +- mesh/mesh-io.h | 3 +- 6 files changed, 582 insertions(+), 17 deletions(-) create mode 100644 mesh/mesh-io-unit.c create mode 100644 mesh/mesh-io-unit.h
Makefile.mesh +2 -0
@@ -17,6 +17,8 @@ mesh_sources = mesh/mesh.h mesh/mesh.c \ mesh/error.h mesh/mesh-io-api.h \ mesh/mesh-io-generic.h \ mesh/mesh-io-generic.c \ + mesh/mesh-io-unit.h \ + mesh/mesh-io-unit.c \ mesh/net.h mesh/net.c \ mesh/crypto.h mesh/crypto.c \ mesh/friend.h mesh/friend.c \
mesh/main.c +30 -11
81 lines not on this page · raw message
mesh/mesh-io-unit.c new file +533 -0
533 lines not on this page · raw message
mesh/mesh-io-unit.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* +* +* BlueZ - Bluetooth protocol stack for Linux +* +* Copyright (C) 2021 Intel Corporation. All rights reserved. +* +* +*/ + +extern const struct mesh_io_api mesh_io_unit;
mesh/mesh-io.c +4 -5
@@ -22,10 +22,12 @@/* List of Mesh-IO Type headers */ #include "mesh/mesh-io-generic.h" +#include "mesh/mesh-io-unit.h" /* List of Supported Mesh-IO Types */ static const struct mesh_io_table table[] = { - {MESH_IO_TYPE_GENERIC , &mesh_io_generic} + {MESH_IO_TYPE_GENERIC , &mesh_io_generic}, + {MESH_IO_TYPE_UNIT_TEST , &mesh_io_unit}, };static struct l_queue *io_list;
@@ -64,12 +66,9 @@ struct mesh_io *mesh_io_new(enum mesh_io_type type, void *opts, io = l_new(struct mesh_io, 1); -if (!io) -return NULL ; - io->type = type; - io->api = api; +if (!api->init (io, opts, cb, user_data)) goto fail;
mesh/mesh-io.h +2 -1
@@ -14,7 +14,8 @@ struct mesh_io;enum mesh_io_type {MESH_IO_TYPE_NONE =0 , -MESH_IO_TYPE_GENERIC +MESH_IO_TYPE_GENERIC , +MESH_IO_TYPE_UNIT_TEST };enum mesh_io_timing_type {
Signature · 1 line
2.26.2
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=451875
---Test result---
##############################
Test: CheckPatch - PASS
##############################
Test: CheckGitLint - PASS
##############################
Test: CheckBuild - FAIL
Output:tools/mesh-cfgtest.c: In function ‘init_continue’:tools/mesh-cfgtest.c:356:7: error: variable ‘stage’ has initializer but incomplete type
356 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~~~~~~~~~~
tools/mesh-cfgtest.c:356:30: error: implicit declaration of function ‘l_tester_get_stage’ [-Werror=implicit-function-declaration]
356 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~~~~~~~~~~~~~~tools/mesh-cfgtest.c:356:22: error: storage size of ‘stage’ isn’t known
356 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c:359:15: error: ‘L_TESTER_STAGE_PRE_SETUP’ undeclared (first use in this function)
359 | stage == L_TESTER_STAGE_PRE_SETUP) {
| ^~~~~~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:359:15: note: each undeclared identifier is reported only once for each function it appears in
tools/mesh-cfgtest.c:360:3: error: implicit declaration of function ‘l_tester_pre_setup_complete’ [-Werror=implicit-function-declaration]
360 | l_tester_pre_setup_complete(tester);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~tools/mesh-cfgtest.c:356:22: error: unused variable ‘stage’ [-Werror=unused-variable]
356 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c: In function ‘test_success’:tools/mesh-cfgtest.c:372:2: error: implicit declaration of function ‘l_tester_test_passed’ [-Werror=implicit-function-declaration]
372 | l_tester_test_passed(tester);
| ^~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c: In function ‘test_fail’:
tools/mesh-cfgtest.c:377:2: error: implicit declaration of function ‘l_tester_test_failed’ [-Werror=implicit-function-declaration]
377 | l_tester_test_failed(tester);
| ^~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c: In function ‘create_appkey_reply’:
tools/mesh-cfgtest.c:480:7: error: variable ‘stage’ has initializer but incomplete type
480 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~~~~~~~~~~tools/mesh-cfgtest.c:480:22: error: storage size of ‘stage’ isn’t known
480 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c:488:16: error: ‘L_TESTER_STAGE_PRE_SETUP’ undeclared (first use in this function)
488 | if (stage == L_TESTER_STAGE_PRE_SETUP) {
| ^~~~~~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:490:4: error: implicit declaration of function ‘l_tester_pre_setup_failed’ [-Werror=implicit-function-declaration]
490 | l_tester_pre_setup_failed(tester);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:492:4: error: implicit declaration of function ‘l_tester_setup_failed’ [-Werror=implicit-function-declaration]
492 | l_tester_setup_failed(tester);
| ^~~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:497:4: error: implicit declaration of function ‘l_tester_setup_complete’ [-Werror=implicit-function-declaration]
497 | l_tester_setup_complete(tester);
| ^~~~~~~~~~~~~~~~~~~~~~~tools/mesh-cfgtest.c:480:22: error: unused variable ‘stage’ [-Werror=unused-variable]
480 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c: In function ‘import_remote_reply’:tools/mesh-cfgtest.c:527:7: error: variable ‘stage’ has initializer but incomplete type
527 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~~~~~~~~~~tools/mesh-cfgtest.c:527:22: error: storage size of ‘stage’ isn’t known
527 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c:535:16: error: ‘L_TESTER_STAGE_PRE_SETUP’ undeclared (first use in this function)
535 | if (stage == L_TESTER_STAGE_PRE_SETUP) {
| ^~~~~~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:546:3: error: implicit declaration of function ‘l_tester_test_abort’ [-Werror=implicit-function-declaration]
546 | l_tester_test_abort(tester);
| ^~~~~~~~~~~~~~~~~~~tools/mesh-cfgtest.c:527:22: error: unused variable ‘stage’ [-Werror=unused-variable]
527 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c: In function ‘import_subnet_reply’:tools/mesh-cfgtest.c:579:7: error: variable ‘stage’ has initializer but incomplete type
579 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~~~~~~~~~~tools/mesh-cfgtest.c:579:22: error: storage size of ‘stage’ isn’t known
579 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c:581:15: error: ‘L_TESTER_STAGE_PRE_SETUP’ undeclared (first use in this function)
581 | if (stage != L_TESTER_STAGE_PRE_SETUP)
| ^~~~~~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:591:10: error: ‘return’ with a value, in function returning void [-Werror=return-type]
591 | return l_tester_pre_setup_failed(tester);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:576:13: note: declared here
576 | static void import_subnet_reply(struct l_dbus_proxy *proxy,
| ^~~~~~~~~~~~~~~~~~~tools/mesh-cfgtest.c:579:22: error: unused variable ‘stage’ [-Werror=unused-variable]
579 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c: In function ‘attach_node_reply’:tools/mesh-cfgtest.c:630:7: error: variable ‘stage’ has initializer but incomplete type
630 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~~~~~~~~~~tools/mesh-cfgtest.c:630:22: error: storage size of ‘stage’ isn’t known
630 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c:660:15: error: ‘L_TESTER_STAGE_PRE_SETUP’ undeclared (first use in this function)
660 | if (stage == L_TESTER_STAGE_PRE_SETUP)
| ^~~~~~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:630:22: error: unused variable ‘stage’ [-Werror=unused-variable]
630 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c: In function ‘join_complete’:tools/mesh-cfgtest.c:703:7: error: variable ‘stage’ has initializer but incomplete type
703 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~~~~~~~~~~tools/mesh-cfgtest.c:703:22: error: storage size of ‘stage’ isn’t known
703 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c:706:16: error: ‘L_TESTER_STAGE_PRE_SETUP’ undeclared (first use in this function)
706 | if (stage == L_TESTER_STAGE_PRE_SETUP) {
| ^~~~~~~~~~~~~~~~~~~~~~~~tools/mesh-cfgtest.c:703:22: error: unused variable ‘stage’ [-Werror=unused-variable]
703 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c: In function ‘dev_msg_recv_call’:tools/mesh-cfgtest.c:967:7: error: variable ‘stage’ has initializer but incomplete type
967 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~~~~~~~~~~tools/mesh-cfgtest.c:967:22: error: storage size of ‘stage’ isn’t known
967 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c:989:15: error: ‘L_TESTER_STAGE_PRE_SETUP’ undeclared (first use in this function)
989 | if (stage == L_TESTER_STAGE_PRE_SETUP) {
| ^~~~~~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:1001:9: error: implicit declaration of function ‘l_tester_get_data’ [-Werror=implicit-function-declaration]
1001 | rsp = l_tester_get_data(tester);
| ^~~~~~~~~~~~~~~~~tools/mesh-cfgtest.c:1001:7: error: assignment to ‘struct msg_data *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
1001 | rsp = l_tester_get_data(tester);
| ^tools/mesh-cfgtest.c:967:22: error: unused variable ‘stage’ [-Werror=unused-variable]
967 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c: In function ‘client_ready’:tools/mesh-cfgtest.c:1171:7: error: variable ‘stage’ has initializer but incomplete type
1171 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~~~~~~~~~~tools/mesh-cfgtest.c:1171:22: error: storage size of ‘stage’ isn’t known
1171 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c:1179:15: error: ‘L_TESTER_STAGE_PRE_SETUP’ undeclared (first use in this function)
1179 | if (stage == L_TESTER_STAGE_PRE_SETUP)
| ^~~~~~~~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:1171:22: error: unused variable ‘stage’ [-Werror=unused-variable]
1171 | enum l_tester_stage stage = l_tester_get_stage(tester);
| ^~~~~tools/mesh-cfgtest.c: In function ‘main’:tools/mesh-cfgtest.c:1407:11: error: implicit declaration of function ‘l_tester_new’; did you mean ‘l_tls_new’? [-Werror=implicit-function-declaration]
1407 | tester = l_tester_new(option_prefix, option_string, option_list);
| ^~~~~~~~~~~~
| l_tls_newtools/mesh-cfgtest.c:1407:9: error: assignment to ‘struct l_tester *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
1407 | tester = l_tester_new(option_prefix, option_string, option_list);
| ^tools/mesh-cfgtest.c:1411:2: error: implicit declaration of function ‘l_tester_add_full’ [-Werror=implicit-function-declaration]
1411 | l_tester_add_full(tester, "Config AppKey Add: Success",
| ^~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:1431:2: error: implicit declaration of function ‘l_tester_start’; did you mean ‘l_tls_start’? [-Werror=implicit-function-declaration]
1431 | l_tester_start(tester, done_callback);
| ^~~~~~~~~~~~~~
| l_tls_start
tools/mesh-cfgtest.c:1436:8: error: implicit declaration of function ‘l_tester_summarize’ [-Werror=implicit-function-declaration]
1436 | if (!l_tester_summarize(tester))
| ^~~~~~~~~~~~~~~~~~
tools/mesh-cfgtest.c:1448:2: error: implicit declaration of function ‘l_tester_destroy’; did you mean ‘l_queue_destroy’? [-Werror=implicit-function-declaration]
1448 | l_tester_destroy(tester);
| ^~~~~~~~~~~~~~~~
| l_queue_destroycc1: all warnings being treated as errors make[1]: *** [Makefile:6846: tools/mesh-cfgtest.o] Error 1
make: *** [Makefile:4058: all] Error 2
##############################
Test: MakeCheck - SKIPPED
Output:
checkbuild not success
---
Regards,
Linux Bluetooth
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=451875
---Test result---
##############################
Test: CheckPatch - PASS
##############################
Test: CheckGitLint - PASS
##############################
Test: CheckBuild: Setup ELL - PASS
##############################
Test: CheckBuild: Setup - PASS
##############################
Test: CheckBuild - PASS
##############################
Test: MakeCheck - PASS
##############################
Test: CheckBuild w/external ell - FAIL
Output:/usr/bin/ld: tools/mesh-cfgtest.o: in function `join_complete':
/github/workspace/src2/tools/mesh-cfgtest.c:703: undefined reference to `l_tester_get_stage'/usr/bin/ld: tools/mesh-cfgtest.o: in function `dev_msg_recv_call':
/github/workspace/src2/tools/mesh-cfgtest.c:967: undefined reference to `l_tester_get_stage'/usr/bin/ld: tools/mesh-cfgtest.o: in function `attach_node_reply':
/github/workspace/src2/tools/mesh-cfgtest.c:630: undefined reference to `l_tester_get_stage'/usr/bin/ld: tools/mesh-cfgtest.o: in function `import_subnet_reply':
/github/workspace/src2/tools/mesh-cfgtest.c:579: undefined reference to `l_tester_get_stage'/usr/bin/ld: tools/mesh-cfgtest.o: in function `create_appkey_reply':
/github/workspace/src2/tools/mesh-cfgtest.c:480: undefined reference to `l_tester_get_stage'/usr/bin/ld: tools/mesh-cfgtest.o:/github/workspace/src2/tools/mesh-cfgtest.c:356: more undefined references to l_tester_get_stage' follow /usr/bin/ld: tools/mesh-cfgtest.o: in function main':
/github/workspace/src2/tools/mesh-cfgtest.c:1411: undefined reference to `l_tester_add_full'/usr/bin/ld: /github/workspace/src2/tools/mesh-cfgtest.c:1415: undefined reference to l_tester_add_full' /usr/bin/ld: /github/workspace/src2/tools/mesh-cfgtest.c:1419: undefined reference to l_tester_add_full' /usr/bin/ld: /github/workspace/src2/tools/mesh-cfgtest.c:1423: undefined reference to l_tester_add_full' /usr/bin/ld: /github/workspace/src2/tools/mesh-cfgtest.c:1427: undefined reference to l_tester_add_full'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:5884: tools/mesh-cfgtest] Error 1
make: *** [Makefile:4058: all] Error 2
---
Regards,
Linux Bluetooth
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=451875
---Test result---
##############################
Test: CheckPatch - PASS
##############################
Test: CheckGitLint - PASS
##############################
Test: CheckBuild: Setup ELL - PASS
##############################
Test: CheckBuild: Setup - PASS
##############################
Test: CheckBuild - PASS
##############################
Test: MakeCheck - PASS
##############################
Test: CheckBuild w/external ell - FAIL
Output:/usr/bin/ld: tools/mesh-cfgtest.o: in function `join_complete':
/github/workspace/src2/tools/mesh-cfgtest.c:703: undefined reference to `l_tester_get_stage'/usr/bin/ld: tools/mesh-cfgtest.o: in function `dev_msg_recv_call':
/github/workspace/src2/tools/mesh-cfgtest.c:967: undefined reference to `l_tester_get_stage'/usr/bin/ld: tools/mesh-cfgtest.o: in function `attach_node_reply':
/github/workspace/src2/tools/mesh-cfgtest.c:630: undefined reference to `l_tester_get_stage'/usr/bin/ld: tools/mesh-cfgtest.o: in function `import_subnet_reply':
/github/workspace/src2/tools/mesh-cfgtest.c:579: undefined reference to `l_tester_get_stage'/usr/bin/ld: tools/mesh-cfgtest.o: in function `create_appkey_reply':
/github/workspace/src2/tools/mesh-cfgtest.c:480: undefined reference to `l_tester_get_stage'/usr/bin/ld: tools/mesh-cfgtest.o:/github/workspace/src2/tools/mesh-cfgtest.c:356: more undefined references to l_tester_get_stage' follow /usr/bin/ld: tools/mesh-cfgtest.o: in function main':
/github/workspace/src2/tools/mesh-cfgtest.c:1411: undefined reference to `l_tester_add_full'/usr/bin/ld: /github/workspace/src2/tools/mesh-cfgtest.c:1415: undefined reference to l_tester_add_full' /usr/bin/ld: /github/workspace/src2/tools/mesh-cfgtest.c:1419: undefined reference to l_tester_add_full' /usr/bin/ld: /github/workspace/src2/tools/mesh-cfgtest.c:1423: undefined reference to l_tester_add_full' /usr/bin/ld: /github/workspace/src2/tools/mesh-cfgtest.c:1427: undefined reference to l_tester_add_full'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:5884: tools/mesh-cfgtest] Error 1
make: *** [Makefile:4058: all] Error 2
---
Regards,
Linux Bluetooth
PATCH v4 2/2 tools/mesh-cfgtest: Non-iteractive test for mesh
In reply to Inga StotlandThis adds a non-interactive test to excercise different datapaths in bluetooth-meshd. The test cases utilize D-Bus based mesh APIs, e.g., to create a new network, import a node, import NetKey, import a remote node.
--- Makefile.am | 14 +- Makefile.tools | 6 + mesh/main.c | 10 +- tools/mesh-cfgtest.c | 1458 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1483 insertions(+), 5 deletions(-) create mode 100644 tools/mesh-cfgtest.c
Makefile.am +10 -4
@@ -115,6 +115,8 @@ ell_headers = ell/util.h \ ell/hashmap.h \ ell/random.h \ ell/signal.h \ + ell/time.h \ + ell/time-private.h \ ell/timeout.h \ ell/cipher.h \ ell/checksum.h \
@@ -137,7 +139,8 @@ ell_headers = ell/util.h \ ell/pem-private.h \ ell/uuid.h \ ell/useful.h \ - ell/main-private.h + ell/main-private.h \ + ell/tester.h ell_sources = ell/private.h ell/missing.h \ ell/util.c \
@@ -146,6 +149,7 @@ ell_sources = ell/private.h ell/missing.h \ ell/hashmap.c \ ell/random.c \ ell/signal.c \ + ell/time.c \ ell/timeout.c \ ell/io.c \ ell/idle.c \
@@ -173,7 +177,8 @@ ell_sources = ell/private.h ell/missing.h \ ell/gvariant-util.c \ ell/siphash-private.h \ ell/siphash.c \ - ell/uuid.c + ell/uuid.c \ + ell/tester.c ell_libell_internal_la_SOURCES = $(ell_headers) $(ell_sources) endif
@@ -193,7 +198,7 @@ shared_sources = src/shared/io.h src/shared/timeout.h \ src/shared/crypto.h src/shared/crypto.c \ src/shared/ecc.h src/shared/ecc.c \ src/shared/ringbuf.h src/shared/ringbuf.c \ - src/shared/tester.h src/shared/tester.c \ + src/shared/tester.h\ src/shared/hci.h src/shared/hci.c \ src/shared/hci-crypto.h src/shared/hci-crypto.c \ src/shared/hfp.h src/shared/hfp.c \
@@ -220,7 +225,8 @@ src_libshared_glib_la_SOURCES = $(shared_sources) \ src/shared/timeout-glib.c \ src/shared/mainloop-glib.c \ src/shared/mainloop-notify.h \ - src/shared/mainloop-notify.c + src/shared/mainloop-notify.c \ + src/shared/tester.c src_libshared_mainloop_la_SOURCES = $(shared_sources) \ src/shared/io-mainloop.c \
Makefile.tools +6 -0
@@ -335,6 +335,12 @@ tools_mesh_cfgclient_SOURCES = tools/mesh-cfgclient.c \ tools_mesh_cfgclient_LDADD = lib/libbluetooth-internal.la src/libshared-ell.la \ $(ell_ldadd) -ljson-c -lreadline + +bin_PROGRAMS += tools/mesh-cfgtest + +tools_mesh_cfgtest_SOURCES = tools/mesh-cfgtest.c +tools_mesh_cfgtest_LDADD = lib/libbluetooth-internal.la src/libshared-ell.la \ + $(ell_ldadd) endif EXTRA_DIST += tools/mesh-gatt/local_node.json tools/mesh-gatt/prov_db.json
mesh/main.c +9 -1
@@ -17,7 +17,9 @@#include <stdlib.h> #include <unistd.h> #include <ctype.h> +#include <signal.h> +#include <sys/prctl.h> #include <sys/stat.h> #include <ell/ell.h>
@@ -262,7 +264,13 @@ int main(int argc, char *argv[])if (!detached)umask (0077 ); - dbus =l_dbus_new_default (L_DBUS_SYSTEM_BUS ); +if (io_type !=MESH_IO_TYPE_UNIT_TEST ) + dbus =l_dbus_new_default (L_DBUS_SYSTEM_BUS ); +else { + dbus =l_dbus_new_default (L_DBUS_SESSION_BUS ); +prctl (PR_SET_PDEATHSIG ,SIGSEGV ); + } +if (!dbus) {l_error ("unable to connect to D-Bus" ); status =EXIT_FAILURE ;
tools/mesh-cfgtest.c new file +1458 -0
1,458 lines not on this page · raw message
Signature · 1 line
2.26.2
Patchset Applied.
Quoted 44 lines · Inga Stotland
v4: Use tester frameworks from ELL library
**********
v3: Fixed copyright style inmesh-io-unit.h**********
v2: Fixed errors reported by bluez-bot.
Regarding the warnings for the "__attribute__((packed))":
keeping this style to be consistent with the rest of BLueZ codebase**********
This patch set introduces a framework for non-interactive testing of mesh daemon functionality and consists of the three components:1. A version of src/shared/tester that uses ELL primitives:
everything mesh-related uses ELL.2. New type of mesh IO used only for testing.
3. The mesh-cfgtest tool that excercises a number of mesh D-Bus API calls. Currently, the tool covers limited number of initial test cases. The extended coverage will be provided after this patch set is accepted.
Brian Gix (1):
mesh: Add unit test IOInga Stotland (1):
tools/mesh-cfgtest: Non-iteractive test for meshMakefile.am | 14 +- Makefile.mesh | 2 + Makefile.tools | 6 + mesh/main.c | 51 +- mesh/mesh-io-unit.c | 533 +++++++++++++++ mesh/mesh-io-unit.h | 11 + mesh/mesh-io.c | 9 +- mesh/mesh-io.h | 3 +- tools/mesh-cfgtest.c | 1458 ++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 2065 insertions(+), 22 deletions(-) create mode 100644 mesh/mesh-io-unit.c create mode 100644 mesh/mesh-io-unit.h create mode 100644 tools/mesh-cfgtest.c