* [PATCH 1/4] unit: add rilmodem test engine
@ 2016-10-24 10:57 Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-24 10:57 ` [PATCH 2/4] unit: add rilmodem gprs tests Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?= @ 2016-10-24 10:57 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 10420 bytes --]
Add rilmodem test engine. This engine is an improvement on the rilmodem
test server that allows us to test generic interactions with the
rilmodem driver. Instead of just be able to check content of received/
sent bytes on the rild socket, we can now specify a set of steps for a
test that include interactions with the atom. The step types are
- TST_ACTION_SEND: The harness sends a parcel
- TST_ACTION_CALL: The harness calls a driver function
- TST_EVENT_RECEIVE: The driver sends a parcel
- TST_EVENT_CALL: The driver calls a harness (atom) function
---
unit/rilmodem-test-engine.c | 280 ++++++++++++++++++++++++++++++++++++++++++++
unit/rilmodem-test-engine.h | 74 ++++++++++++
2 files changed, 354 insertions(+)
create mode 100644 unit/rilmodem-test-engine.c
create mode 100644 unit/rilmodem-test-engine.h
diff --git a/unit/rilmodem-test-engine.c b/unit/rilmodem-test-engine.c
new file mode 100644
index 0000000..c569360
--- /dev/null
+++ b/unit/rilmodem-test-engine.c
@@ -0,0 +1,280 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2016 Canonical Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+
+#include <ofono/types.h>
+
+#include <gril.h>
+
+#include "rilmodem-test-engine.h"
+
+#define MAX_REQUEST_SIZE 4096
+#define RIL_SERVER_SOCK_PATH "/tmp/unittestril"
+
+static GMainLoop *mainloop;
+
+struct engine_data {
+ int server_sk;
+ int connected_sk;
+ guint connection_watch;
+ rilmodem_test_engine_cb_t connect_func;
+ GIOChannel *server_io;
+ char *sock_name;
+ struct rilmodem_test_data rtd;
+ int step_i;
+ void *user_data;
+};
+
+static void send_parcel(struct engine_data *ed)
+{
+ GIOStatus status;
+ gsize wbytes;
+ const struct rilmodem_test_step *step = &ed->rtd.steps[ed->step_i];
+
+ status = g_io_channel_write_chars(ed->server_io,
+ step->parcel_data,
+ step->parcel_size,
+ &wbytes, NULL);
+
+ g_assert(wbytes == step->parcel_size);
+ g_assert(status == G_IO_STATUS_NORMAL);
+
+ status = g_io_channel_flush(ed->server_io, NULL);
+ g_assert(status == G_IO_STATUS_NORMAL);
+
+ rilmodem_test_engine_next_step(ed);
+}
+
+static gboolean on_rx_data(GIOChannel *chan, GIOCondition cond, gpointer data)
+{
+ struct engine_data *ed = data;
+ GIOStatus status;
+ gsize rbytes;
+ gchar *buf;
+ const struct rilmodem_test_step *step;
+
+ /* We have closed the socket */
+ if (cond == G_IO_NVAL)
+ return FALSE;
+
+ buf = g_malloc0(MAX_REQUEST_SIZE);
+
+ status = g_io_channel_read_chars(ed->server_io, buf, MAX_REQUEST_SIZE,
+ &rbytes, NULL);
+ g_assert(status == G_IO_STATUS_NORMAL);
+
+ /* Check this is the expected step */
+ step = &ed->rtd.steps[ed->step_i];
+ g_assert(step->type == TST_EVENT_RECEIVE);
+
+ g_assert(rbytes == step->parcel_size);
+
+ /* validate received parcel */
+ g_assert(!memcmp(buf, step->parcel_data, rbytes));
+
+ rilmodem_test_engine_next_step(ed);
+
+ return TRUE;
+}
+
+static gboolean on_socket_connected(GIOChannel *chan, GIOCondition cond,
+ gpointer data)
+{
+ struct engine_data *ed = data;
+ struct sockaddr saddr;
+ unsigned int len = sizeof(saddr);
+ GIOStatus status;
+
+ g_assert(cond == G_IO_IN);
+
+ ed->connected_sk = accept(ed->server_sk, &saddr, &len);
+ g_assert(ed->connected_sk != -1);
+
+ ed->server_io = g_io_channel_unix_new(ed->connected_sk);
+ g_assert(ed->server_io != NULL);
+
+ status = g_io_channel_set_encoding(ed->server_io, NULL, NULL);
+ g_assert(status == G_IO_STATUS_NORMAL);
+
+ g_io_channel_set_buffered(ed->server_io, FALSE);
+ g_io_channel_set_close_on_unref(ed->server_io, TRUE);
+
+ if (ed->connect_func)
+ ed->connect_func(ed->user_data);
+
+ ed->connection_watch =
+ g_io_add_watch_full(ed->server_io, G_PRIORITY_DEFAULT,
+ G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+ on_rx_data, ed, NULL);
+ g_io_channel_unref(ed->server_io);
+
+ return FALSE;
+}
+
+void rilmodem_test_engine_remove(struct engine_data *ed)
+{
+ if (ed->connection_watch)
+ g_source_remove(ed->connection_watch);
+
+ g_assert(ed->server_sk);
+ close(ed->server_sk);
+ remove(ed->sock_name);
+ g_free(ed->sock_name);
+ g_free(ed);
+}
+
+struct engine_data *rilmodem_test_engine_create(
+ rilmodem_test_engine_cb_t connect,
+ const struct rilmodem_test_data *test_data,
+ void *data)
+{
+ GIOChannel *io;
+ struct sockaddr_un addr;
+ int retval;
+ struct engine_data *ed;
+
+ ed = g_new0(struct engine_data, 1);
+
+ ed->connect_func = connect;
+ ed->user_data = data;
+ ed->rtd = *test_data;
+
+ ed->server_sk = socket(AF_UNIX, SOCK_STREAM, 0);
+ g_assert(ed->server_sk);
+
+ ed->sock_name =
+ g_strdup_printf(RIL_SERVER_SOCK_PATH"%u", (unsigned) getpid());
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_UNIX;
+ strncpy(addr.sun_path, ed->sock_name, sizeof(addr.sun_path) - 1);
+
+ /* Unlink any existing socket for this session */
+ unlink(addr.sun_path);
+
+ retval = bind(ed->server_sk, (struct sockaddr *) &addr, sizeof(addr));
+ g_assert(retval >= 0);
+
+ retval = listen(ed->server_sk, 0);
+ g_assert(retval >= 0);
+
+ io = g_io_channel_unix_new(ed->server_sk);
+ g_assert(io != NULL);
+
+ g_io_channel_set_close_on_unref(io, TRUE);
+ g_io_add_watch_full(io, G_PRIORITY_DEFAULT,
+ G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+ on_socket_connected, ed, NULL);
+
+ g_io_channel_unref(io);
+
+ return ed;
+}
+
+void rilmodem_test_engine_write_socket(struct engine_data *ed,
+ const unsigned char *buf,
+ const size_t buf_len)
+{
+ GIOStatus status;
+ gsize wbytes;
+
+ status = g_io_channel_write_chars(ed->server_io,
+ (const char *) buf,
+ buf_len,
+ &wbytes, NULL);
+
+ g_assert(status == G_IO_STATUS_NORMAL);
+
+ status = g_io_channel_flush(ed->server_io, NULL);
+
+ g_assert(status == G_IO_STATUS_NORMAL);
+}
+
+const char *rilmodem_test_engine_get_socket_name(struct engine_data *ed)
+{
+ return ed->sock_name;
+}
+
+static gboolean action_call(gpointer data)
+{
+ struct engine_data *ed = data;
+ const struct rilmodem_test_step *step;
+
+ step = &ed->rtd.steps[ed->step_i];
+
+ step->call_action(ed->user_data);
+
+ return FALSE;
+}
+
+void rilmodem_test_engine_next_step(struct engine_data *ed)
+{
+ const struct rilmodem_test_step *step;
+
+ ed->step_i++;
+
+ if (ed->step_i >= ed->rtd.num_steps) {
+ /* Finish the test */
+ g_main_loop_quit(mainloop);
+ return;
+ }
+
+ step = &ed->rtd.steps[ed->step_i];
+
+ /* If next step is an action, execute it */
+ switch (step->type) {
+ case TST_ACTION_SEND:
+ send_parcel(ed);
+ break;
+ case TST_ACTION_CALL:
+ g_idle_add(action_call, ed);
+ break;
+ case TST_EVENT_RECEIVE:
+ case TST_EVENT_CALL:
+ break;
+ };
+}
+
+const struct rilmodem_test_step *rilmodem_test_engine_get_current_step(
+ struct engine_data *ed)
+{
+ const struct rilmodem_test_step *step = &ed->rtd.steps[ed->step_i];
+
+ return step;
+}
+
+void rilmodem_test_engine_start(struct engine_data *ed)
+{
+ mainloop = g_main_loop_new(NULL, FALSE);
+
+ g_main_loop_run(mainloop);
+ g_main_loop_unref(mainloop);
+}
diff --git a/unit/rilmodem-test-engine.h b/unit/rilmodem-test-engine.h
new file mode 100644
index 0000000..185d9bc
--- /dev/null
+++ b/unit/rilmodem-test-engine.h
@@ -0,0 +1,74 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2016 Canonical Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+struct engine_data;
+
+enum test_step_type {
+ TST_ACTION_SEND,
+ TST_ACTION_CALL,
+ TST_EVENT_RECEIVE,
+ TST_EVENT_CALL,
+};
+
+typedef void (*rilmodem_test_engine_cb_t)(void *data);
+
+struct rilmodem_test_step {
+ enum test_step_type type;
+
+ union {
+ /* For TST_ACTION_CALL */
+ rilmodem_test_engine_cb_t call_action;
+ /* For TST_ACTION_SEND or TST_EVENT_RECEIVE */
+ struct {
+ const char *parcel_data;
+ const size_t parcel_size;
+ };
+ /* For TST_EVENT_CALL */
+ struct {
+ void (*call_func)(void);
+ void (*check_func)(void);
+ };
+ };
+};
+
+struct rilmodem_test_data {
+ const struct rilmodem_test_step *steps;
+ int num_steps;
+};
+
+void rilmodem_test_engine_remove(struct engine_data *ed);
+
+struct engine_data *rilmodem_test_engine_create(
+ rilmodem_test_engine_cb_t connect,
+ const struct rilmodem_test_data *test_data,
+ void *data);
+
+void rilmodem_test_engine_write_socket(struct engine_data *ed,
+ const unsigned char *buf,
+ const size_t buf_len);
+
+const char *rilmodem_test_engine_get_socket_name(struct engine_data *ed);
+
+void rilmodem_test_engine_next_step(struct engine_data *ed);
+const struct rilmodem_test_step *rilmodem_test_engine_get_current_step(
+ struct engine_data *ed);
+
+void rilmodem_test_engine_start(struct engine_data *ed);
--
2.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] unit: add rilmodem gprs tests
2016-10-24 10:57 [PATCH 1/4] unit: add rilmodem test engine Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
@ 2016-10-24 10:57 ` Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-24 10:57 ` [PATCH 3/4] build: add rilmodem gprs unit tests Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?= @ 2016-10-24 10:57 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 22974 bytes --]
Add rilmodem gprs tests, which use the rilmodem test engine.
---
unit/test-rilmodem-gprs.c | 750 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 750 insertions(+)
create mode 100644 unit/test-rilmodem-gprs.c
diff --git a/unit/test-rilmodem-gprs.c b/unit/test-rilmodem-gprs.c
new file mode 100644
index 0000000..057c51e
--- /dev/null
+++ b/unit/test-rilmodem-gprs.c
@@ -0,0 +1,750 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2016 Canonical Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define _GNU_SOURCE
+#include <assert.h>
+#include <errno.h>
+#include <glib.h>
+#include <stdio.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+
+#include <ofono/modem.h>
+#include <ofono/types.h>
+#include <ofono/gprs.h>
+#include <gril.h>
+#include <drivers/rilmodem/rilutil.h>
+
+#include "common.h"
+#include "ril_constants.h"
+#include "rilmodem-test-engine.h"
+
+static const struct ofono_gprs_driver *gprs_drv;
+
+/* Declarations && Re-implementations of core functions. */
+void ril_gprs_exit(void);
+void ril_gprs_init(void);
+
+struct ofono_modem;
+
+struct ofono_gprs {
+ void *driver_data;
+ GRil *ril;
+ struct ofono_modem *modem;
+ struct engine_data *engined;
+};
+
+struct ofono_modem {
+ struct ofono_gprs *gprs;
+};
+
+int ofono_gprs_driver_register(const struct ofono_gprs_driver *d)
+{
+ if (gprs_drv == NULL)
+ gprs_drv = d;
+
+ return 0;
+}
+
+void ofono_gprs_driver_unregister(const struct ofono_gprs_driver *d)
+{
+ gprs_drv = NULL;
+}
+
+void ofono_gprs_register(struct ofono_gprs *gprs)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_gprs_register);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+void ofono_gprs_set_data(struct ofono_gprs *gprs, void *data)
+{
+ gprs->driver_data = data;
+}
+
+void *ofono_gprs_get_data(struct ofono_gprs *gprs)
+{
+ return gprs->driver_data;
+}
+
+void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_gprs_status_notify);
+
+ if (step->check_func != NULL)
+ ((void (*)(struct ofono_gprs *, int)) step->check_func)(
+ gprs, status);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+void ofono_gprs_detached_notify(struct ofono_gprs *gprs)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func ==
+ (void (*)(void)) ofono_gprs_detached_notify);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+void ofono_gprs_bearer_notify(struct ofono_gprs *gprs, int bearer)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_gprs_bearer_notify);
+
+ if (step->check_func != NULL)
+ ((void (*)(struct ofono_gprs *, int)) step->check_func)(
+ gprs, bearer);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
+ unsigned int min, unsigned int max)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_gprs_set_cid_range);
+
+ if (step->check_func != NULL)
+ ((void (*)(struct ofono_gprs *, unsigned int, unsigned int))
+ step->check_func)(gprs, min, max);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+struct ofono_modem *ofono_gprs_get_modem(struct ofono_gprs *gprs)
+{
+ return gprs->modem;
+}
+
+int ofono_modem_set_integer(struct ofono_modem *modem,
+ const char *key, int value)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(modem->gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_modem_set_integer);
+
+ if (step->check_func != NULL)
+ ((void (*)(struct ofono_modem *, const char *, int))
+ step->check_func)(modem, key, value);
+
+ rilmodem_test_engine_next_step(modem->gprs->engined);
+
+ return 0;
+}
+
+void ofono_gprs_remove(struct ofono_gprs *gprs)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_gprs_remove);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+/*
+ * As all our architectures are little-endian except for
+ * PowerPC, and the Binder wire-format differs slightly
+ * depending on endian-ness, the following guards against test
+ * failures when run on PowerPC.
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+/* REQUEST_DATA_CALL_LIST, seq 1 */
+static const char parcel_req_data_call_list_1_1[] = {
+ 0x00, 0x00, 0x00, 0x08, 0x39, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+/*
+ * --- TEST 1 ---
+ * Step 1: Driver sends REQUEST_DATA_CALL_LIST
+ */
+static const struct rilmodem_test_step steps_test_1[] = {
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_data_call_list_1_1,
+ .parcel_size = sizeof(parcel_req_data_call_list_1_1)
+ }
+};
+
+struct rilmodem_test_data test_1 = {
+ .steps = steps_test_1,
+ .num_steps = G_N_ELEMENTS(steps_test_1)
+};
+
+/* REQUEST_DATA_CALL_LIST, seq 1 */
+static const char parcel_req_data_call_list_2_1[] = {
+ 0x00, 0x00, 0x00, 0x08, 0x39, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+/* Response, no errors */
+static const char parcel_rsp_data_call_list_2_2[] = {
+ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+/* REQUEST_DATA_REGISTRATION_STATE, seq 2 */
+static const char parcel_req_data_registration_state_2_3[] = {
+ 0x00, 0x00, 0x00, 0x08, 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
+};
+
+/* Responso, no error, {unregistered,0xb08,0x10e1,GPRS,(null),4} */
+static const char parcel_rsp_data_registration_state_2_4[] = {
+ 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x30, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x62, 0x00,
+ 0x30, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x31, 0x00, 0x30, 0x00,
+ 0x65, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x34, 0x00, 0x00, 0x00
+};
+
+static void set_cid_range_check_2_5(struct ofono_gprs *gprs,
+ unsigned int min, unsigned int max)
+{
+ g_assert(min == 1);
+ g_assert(max == 2);
+}
+
+static void gprs_cb_2_8(const struct ofono_error *error, void *data)
+{
+ struct ofono_gprs *gprs = data;
+
+ g_assert(error->type == OFONO_ERROR_TYPE_NO_ERROR);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+static void call_set_attached_2_7(gpointer data)
+{
+ struct ofono_gprs *gprs = data;
+
+ gprs_drv->set_attached(gprs, 0, gprs_cb_2_8, gprs);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+/*
+ * --- TEST 2 ---
+ * Step 1: Driver sends REQUEST_DATA_CALL_LIST
+ * Step 2: Harness answers with empty data call list
+ * Step 3: Driver sends REQUEST_DATA_REGISTRATION_STATE
+ * Step 4: Harness answers with status unregistered
+ * Step 5: Driver calls ofono_gprs_set_cid_range
+ * Step 6: Driver calls ofono_gprs_register
+ * Step 7: Harness calls drv->set_attached(false)
+ * Step 8: Driver calls the callback specified in step 7
+ */
+static const struct rilmodem_test_step steps_test_2[] = {
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_data_call_list_2_1,
+ .parcel_size = sizeof(parcel_req_data_call_list_2_1)
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_rsp_data_call_list_2_2,
+ .parcel_size = sizeof(parcel_rsp_data_call_list_2_2)
+ },
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_data_registration_state_2_3,
+ .parcel_size = sizeof(parcel_req_data_registration_state_2_3)
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_rsp_data_registration_state_2_4,
+ .parcel_size = sizeof(parcel_rsp_data_registration_state_2_4)
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_set_cid_range,
+ .check_func = (void (*)(void)) set_cid_range_check_2_5
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_register,
+ .check_func = NULL
+ },
+ {
+ .type = TST_ACTION_CALL,
+ .call_action = call_set_attached_2_7,
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) gprs_cb_2_8,
+ .check_func = NULL
+ },
+};
+
+struct rilmodem_test_data test_2 = {
+ .steps = steps_test_2,
+ .num_steps = G_N_ELEMENTS(steps_test_2)
+};
+
+static void gprs_cb_3_8(const struct ofono_error *error, void *data)
+{
+ struct ofono_gprs *gprs = data;
+
+ g_assert(error->type == OFONO_ERROR_TYPE_NO_ERROR);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+static void call_set_attached_3_7(gpointer data)
+{
+ struct ofono_gprs *gprs = data;
+
+ gprs_drv->set_attached(gprs, 1, gprs_cb_3_8, gprs);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+/*
+ * --- TEST 3 ---
+ * Steps 1-6: Same as in test 2
+ * Step 7: Harness calls drv->set_attached(true)
+ * Step 8: Driver calls the callback specified in step 7
+ */
+static const struct rilmodem_test_step steps_test_3[] = {
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_data_call_list_2_1,
+ .parcel_size = sizeof(parcel_req_data_call_list_2_1)
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_rsp_data_call_list_2_2,
+ .parcel_size = sizeof(parcel_rsp_data_call_list_2_2)
+ },
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_data_registration_state_2_3,
+ .parcel_size = sizeof(parcel_req_data_registration_state_2_3)
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_rsp_data_registration_state_2_4,
+ .parcel_size = sizeof(parcel_rsp_data_registration_state_2_4)
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_set_cid_range,
+ .check_func = (void (*)(void)) set_cid_range_check_2_5
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_register,
+ .check_func = NULL
+ },
+ {
+ .type = TST_ACTION_CALL,
+ .call_action = call_set_attached_3_7,
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) gprs_cb_3_8,
+ .check_func = NULL
+ },
+};
+
+struct rilmodem_test_data test_3 = {
+ .steps = steps_test_3,
+ .num_steps = G_N_ELEMENTS(steps_test_3)
+};
+
+
+/* REQUEST_DATA_REGISTRATION_STATE, seq 3 */
+static const char parcel_req_registration_state_4_8[] = {
+ 0x00, 0x00, 0x00, 0x08, 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
+};
+
+/* Response, no error, {registered,0xb08,0x10e1,GPRS,(null),4} */
+static const char parcel_rsp_registration_state_4_9[] = {
+ 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x62, 0x00,
+ 0x30, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x31, 0x00, 0x30, 0x00,
+ 0x65, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x34, 0x00, 0x00, 0x00
+};
+
+static void reg_state_cb_4_12(const struct ofono_error *error,
+ int status, void *data)
+{
+ struct ofono_gprs *gprs = data;
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) reg_state_cb_4_12);
+
+ g_assert(error->type == OFONO_ERROR_TYPE_NO_ERROR);
+ /*
+ * Driver returns unregistered even though network state is attached
+ * because we did not set attach to true in this test case.
+ */
+ g_assert(status == NETWORK_REGISTRATION_STATUS_NOT_REGISTERED);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+static void call_registration_status_4_7(gpointer data)
+{
+ struct ofono_gprs *gprs = data;
+
+ gprs_drv->attached_status(gprs, reg_state_cb_4_12, gprs);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+static void set_integer_check_4_10(struct ofono_modem *modem,
+ const char *key, int value)
+{
+ g_assert_cmpstr(key, ==, "RilDataRadioTechnology");
+ g_assert(value == RADIO_TECH_GPRS);
+}
+
+static void gprs_bearer_check_4_11(struct ofono_gprs *gprs, int bearer)
+{
+ g_assert(bearer == PACKET_BEARER_GPRS);
+}
+
+/*
+ * --- TEST 4 ---
+ * Steps 1-6: Same as in test 2
+ * Step 7: Harness calls drv->registration_status
+ * Step 8: Driver sends REQUEST_DATA_REGISTRATION_STATE
+ * Step 9: Harness answers saying status is registered
+ * Step 10: Driver calls ofono_modem_set_integer
+ * Step 11: Driver calls ofono_gprs_bearer_notify(PACKET_BEARER_GPRS)
+ * Step 12: Driver calls the callback specified in step 7
+ */
+static const struct rilmodem_test_step steps_test_4[] = {
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_data_call_list_2_1,
+ .parcel_size = sizeof(parcel_req_data_call_list_2_1)
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_rsp_data_call_list_2_2,
+ .parcel_size = sizeof(parcel_rsp_data_call_list_2_2)
+ },
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_data_registration_state_2_3,
+ .parcel_size = sizeof(parcel_req_data_registration_state_2_3)
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_rsp_data_registration_state_2_4,
+ .parcel_size = sizeof(parcel_rsp_data_registration_state_2_4)
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_set_cid_range,
+ .check_func = (void (*)(void)) set_cid_range_check_2_5
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_register,
+ .check_func = NULL
+ },
+ {
+ .type = TST_ACTION_CALL,
+ .call_action = call_registration_status_4_7,
+ },
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_registration_state_4_8,
+ .parcel_size = sizeof(parcel_req_registration_state_4_8)
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_rsp_registration_state_4_9,
+ .parcel_size = sizeof(parcel_rsp_registration_state_4_9)
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_modem_set_integer,
+ .check_func = (void (*)(void)) set_integer_check_4_10
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_bearer_notify,
+ .check_func = (void (*)(void)) gprs_bearer_check_4_11
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) reg_state_cb_4_12,
+ .check_func = NULL
+ },
+};
+
+struct rilmodem_test_data test_4 = {
+ .steps = steps_test_4,
+ .num_steps = G_N_ELEMENTS(steps_test_4)
+};
+
+/* UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED */
+static const char parcel_ev_network_state_changed_5_9[] = {
+ 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0xEA, 0x03, 0x00, 0x00
+};
+
+/* REQUEST_DATA_REGISTRATION_STATE, seq 3 */
+static const char parcel_req_registration_state_5_10[] = {
+ 0x00, 0x00, 0x00, 0x08, 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
+};
+
+/* Response, no error, {registered,0xb08,0x10e1,GPRS,(null),4} */
+static const char parcel_rsp_registration_state_5_11[] = {
+ 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x62, 0x00,
+ 0x30, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x31, 0x00, 0x30, 0x00,
+ 0x65, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x34, 0x00, 0x00, 0x00
+};
+
+static void gprs_status_check_5_12(struct ofono_gprs *gprs, int status)
+{
+ g_assert(status == NETWORK_REGISTRATION_STATUS_REGISTERED);
+}
+
+static void set_integer_check_5_13(struct ofono_modem *modem,
+ const char *key, int value)
+{
+ g_assert_cmpstr(key, ==, "RilDataRadioTechnology");
+ g_assert(value == RADIO_TECH_GPRS);
+}
+
+static void gprs_bearer_check_5_14(struct ofono_gprs *gprs, int bearer)
+{
+ g_assert(bearer == PACKET_BEARER_GPRS);
+}
+
+/*
+ * --- TEST 5 ---
+ * Steps 1-8: Same as test 3
+ * Step 9: Harness sends UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED
+ * Step 10: Driver sends REQUEST_DATA_REGISTRATION_STATE
+ * Step 11: Harness answers saying status is registered
+ * Step 12: Driver calls ofono_gprs_status_notify(REGISTERED)
+ * Step 13: Driver calls ofono_modem_set_integer
+ * Step 14: Driver calls ofono_gprs_bearer_notify(PACKET_BEARER_GPRS)
+ */
+static const struct rilmodem_test_step steps_test_5[] = {
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_data_call_list_2_1,
+ .parcel_size = sizeof(parcel_req_data_call_list_2_1)
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_rsp_data_call_list_2_2,
+ .parcel_size = sizeof(parcel_rsp_data_call_list_2_2)
+ },
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_data_registration_state_2_3,
+ .parcel_size = sizeof(parcel_req_data_registration_state_2_3)
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_rsp_data_registration_state_2_4,
+ .parcel_size = sizeof(parcel_rsp_data_registration_state_2_4)
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_set_cid_range,
+ .check_func = (void (*)(void)) set_cid_range_check_2_5
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_register,
+ .check_func = NULL
+ },
+ {
+ .type = TST_ACTION_CALL,
+ .call_action = call_set_attached_3_7,
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) gprs_cb_3_8,
+ .check_func = NULL
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_ev_network_state_changed_5_9,
+ .parcel_size = sizeof(parcel_ev_network_state_changed_5_9)
+ },
+ {
+ .type = TST_EVENT_RECEIVE,
+ .parcel_data = parcel_req_registration_state_5_10,
+ .parcel_size = sizeof(parcel_req_registration_state_5_10)
+ },
+ {
+ .type = TST_ACTION_SEND,
+ .parcel_data = parcel_rsp_registration_state_5_11,
+ .parcel_size = sizeof(parcel_rsp_registration_state_5_11)
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_status_notify,
+ .check_func = (void (*)(void)) gprs_status_check_5_12
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_modem_set_integer,
+ .check_func = (void (*)(void)) set_integer_check_5_13
+ },
+ {
+ .type = TST_EVENT_CALL,
+ .call_func = (void (*)(void)) ofono_gprs_bearer_notify,
+ .check_func = (void (*)(void)) gprs_bearer_check_5_14
+ },
+};
+
+struct rilmodem_test_data test_5 = {
+ .steps = steps_test_5,
+ .num_steps = G_N_ELEMENTS(steps_test_5)
+};
+
+static void server_connect_cb(gpointer data)
+{
+ struct ofono_gprs *gprs = data;
+ int retval;
+
+ /*
+ * This triggers the first event from the gprs atom, which is a request
+ * to retrieve currently active data calls. Test steps must start from
+ * there.
+ */
+ retval = gprs_drv->probe(gprs, OFONO_RIL_VENDOR_AOSP, gprs->ril);
+ g_assert(retval == 0);
+}
+
+/*
+ * This unit test:
+ * - does some test data setup
+ * - configures a dummy server socket
+ * - creates a new gril client instance
+ * - triggers a connect to the dummy
+ * server socket
+ * - starts the test engine
+ */
+static void test_function(gconstpointer data)
+{
+ const struct rilmodem_test_data *test_data = data;
+ struct ofono_gprs *gprs;
+ struct ofono_modem *modem;
+
+ ril_gprs_init();
+
+ gprs = g_malloc0(sizeof(*gprs));
+ modem = g_malloc0(sizeof(*modem));
+
+ modem->gprs = gprs;
+ gprs->modem = modem;
+
+ gprs->engined = rilmodem_test_engine_create(&server_connect_cb,
+ test_data, gprs);
+
+ gprs->ril = g_ril_new(rilmodem_test_engine_get_socket_name(gprs->engined),
+ OFONO_RIL_VENDOR_AOSP);
+ g_assert(gprs->ril != NULL);
+
+ /* Perform test */
+ rilmodem_test_engine_start(gprs->engined);
+
+ gprs_drv->remove(gprs);
+ g_ril_unref(gprs->ril);
+ g_free(modem);
+ g_free(gprs);
+
+ rilmodem_test_engine_remove(gprs->engined);
+
+ ril_gprs_exit();
+}
+
+#endif
+
+int main(int argc, char **argv)
+{
+ g_test_init(&argc, &argv, NULL);
+
+/*
+ * As all our architectures are little-endian except for
+ * PowerPC, and the Binder wire-format differs slightly
+ * depending on endian-ness, the following guards against test
+ * failures when run on PowerPC.
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ g_test_add_data_func("/test-rilmodem-gprs/1", &test_1, test_function);
+ g_test_add_data_func("/test-rilmodem-gprs/2", &test_2, test_function);
+ g_test_add_data_func("/test-rilmodem-gprs/3", &test_3, test_function);
+ g_test_add_data_func("/test-rilmodem-gprs/4", &test_4, test_function);
+ g_test_add_data_func("/test-rilmodem-gprs/5", &test_5, test_function);
+#endif
+ return g_test_run();
+}
--
2.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] build: add rilmodem gprs unit tests
2016-10-24 10:57 [PATCH 1/4] unit: add rilmodem test engine Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-24 10:57 ` [PATCH 2/4] unit: add rilmodem gprs tests Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
@ 2016-10-24 10:57 ` Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-24 10:57 ` [PATCH 4/4] gitignore: unit/test-rilmodem-gprs binary Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-25 16:52 ` [PATCH 1/4] unit: add rilmodem test engine Denis Kenzior
3 siblings, 0 replies; 5+ messages in thread
From: Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?= @ 2016-10-24 10:57 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1574 bytes --]
---
Makefile.am | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 16865ee..acd5083 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -775,7 +775,8 @@ unit_tests = unit/test-common unit/test-util unit/test-idmap \
unit/test-sms unit/test-cdmasms \
unit/test-rilmodem-cs \
unit/test-rilmodem-sms \
- unit/test-rilmodem-cb
+ unit/test-rilmodem-cb \
+ unit/test-rilmodem-gprs
noinst_PROGRAMS = $(unit_tests) \
unit/test-sms-root unit/test-mux unit/test-caif
@@ -831,7 +832,10 @@ test_rilmodem_sources = $(gril_sources) src/log.c src/common.c src/util.c \
gatchat/ringbuffer.h gatchat/ringbuffer.c \
unit/rilmodem-test-server.h \
unit/rilmodem-test-server.c \
- src/simutil.c
+ unit/rilmodem-test-engine.h \
+ unit/rilmodem-test-engine.c \
+ src/simutil.c \
+ drivers/rilmodem/rilutil.c
unit_test_rilmodem_cs_SOURCES = $(test_rilmodem_sources) \
unit/test-rilmodem-cs.c \
@@ -854,6 +858,13 @@ unit_test_rilmodem_cb_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
unit_objects += $(unit_test_rilmodem_cb_OBJECTS)
+unit_test_rilmodem_gprs_SOURCES = $(test_rilmodem_sources) \
+ unit/test-rilmodem-gprs.c \
+ drivers/rilmodem/gprs.c
+unit_test_rilmodem_gprs_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
+ @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+unit_objects += $(unit_test_rilmodem_gprs_OBJECTS)
+
TESTS = $(unit_tests)
if TOOLS
--
2.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] gitignore: unit/test-rilmodem-gprs binary
2016-10-24 10:57 [PATCH 1/4] unit: add rilmodem test engine Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-24 10:57 ` [PATCH 2/4] unit: add rilmodem gprs tests Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-24 10:57 ` [PATCH 3/4] build: add rilmodem gprs unit tests Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
@ 2016-10-24 10:57 ` Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-25 16:52 ` [PATCH 1/4] unit: add rilmodem test engine Denis Kenzior
3 siblings, 0 replies; 5+ messages in thread
From: Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?= @ 2016-10-24 10:57 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 370 bytes --]
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 6120189..8787587 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,6 +46,7 @@ unit/test-stkutil
unit/test-cdmasms
unit/test-rilmodem-cb
unit/test-rilmodem-cs
+unit/test-rilmodem-gprs
unit/test-rilmodem-sms
unit/test-*.log
unit/test-*.trs
--
2.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/4] unit: add rilmodem test engine
2016-10-24 10:57 [PATCH 1/4] unit: add rilmodem test engine Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
` (2 preceding siblings ...)
2016-10-24 10:57 ` [PATCH 4/4] gitignore: unit/test-rilmodem-gprs binary Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
@ 2016-10-25 16:52 ` Denis Kenzior
3 siblings, 0 replies; 5+ messages in thread
From: Denis Kenzior @ 2016-10-25 16:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 991 bytes --]
Hi Alfonso,
On 10/24/2016 05:57 AM, Alfonso Sánchez-Beato wrote:
> Add rilmodem test engine. This engine is an improvement on the rilmodem
> test server that allows us to test generic interactions with the
> rilmodem driver. Instead of just be able to check content of received/
> sent bytes on the rild socket, we can now specify a set of steps for a
> test that include interactions with the atom. The step types are
>
> - TST_ACTION_SEND: The harness sends a parcel
> - TST_ACTION_CALL: The harness calls a driver function
> - TST_EVENT_RECEIVE: The driver sends a parcel
> - TST_EVENT_CALL: The driver calls a harness (atom) function
> ---
> unit/rilmodem-test-engine.c | 280 ++++++++++++++++++++++++++++++++++++++++++++
> unit/rilmodem-test-engine.h | 74 ++++++++++++
> 2 files changed, 354 insertions(+)
> create mode 100644 unit/rilmodem-test-engine.c
> create mode 100644 unit/rilmodem-test-engine.h
>
All 4 applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-10-25 16:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-24 10:57 [PATCH 1/4] unit: add rilmodem test engine Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-24 10:57 ` [PATCH 2/4] unit: add rilmodem gprs tests Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-24 10:57 ` [PATCH 3/4] build: add rilmodem gprs unit tests Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-24 10:57 ` [PATCH 4/4] gitignore: unit/test-rilmodem-gprs binary Alfonso =?unknown-8bit?q?S=C3=A1nchez-Beato?=
2016-10-25 16:52 ` [PATCH 1/4] unit: add rilmodem test engine Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.