All of lore.kernel.org
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH 05/11] android/test: Add initial HAL IPC unit tests
Date: Tue, 19 Aug 2014 21:51:06 +0200	[thread overview]
Message-ID: <1408477872-24160-5-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1408477872-24160-1-git-send-email-szymon.janc@tieto.com>

---
 .gitignore             |  1 +
 android/Makefile.am    |  9 ++++++++
 android/test-hal-ipc.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+)
 create mode 100644 android/test-hal-ipc.c

diff --git a/.gitignore b/.gitignore
index 1ee35e2..35e96ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -131,6 +131,7 @@ android/android-tester
 android/ipc-tester
 android/bluetoothd-snoop
 android/test-ipc
+android/test-hal-ipc
 android/test-*.log
 android/test-*.trs
 
diff --git a/android/Makefile.am b/android/Makefile.am
index 4b93c5b..bc9efe3 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -231,6 +231,15 @@ android_test_ipc_SOURCES = android/test-ipc.c \
 				android/ipc.c android/ipc.h
 android_test_ipc_LDADD = @GLIB_LIBS@
 
+unit_tests += android/test-hal-ipc
+
+android_test_hal_ipc_SOURCES = android/test-hal-ipc.c \
+				src/shared/util.h src/shared/util.c \
+				android/ipc-common.h \
+				android/hal-ipc.c android/hal-ipc.h
+android_test_hal_ipc_LDADD = @GLIB_LIBS@
+android_test_hal_ipc_LDFLAGS = $(AM_LDFLAGS) -pthread
+
 plugin_LTLIBRARIES += android/audio.a2dp.default.la
 
 android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
diff --git a/android/test-hal-ipc.c b/android/test-hal-ipc.c
new file mode 100644
index 0000000..22b6072
--- /dev/null
+++ b/android/test-hal-ipc.c
@@ -0,0 +1,63 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; 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
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <inttypes.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <glib.h>
+#include "android/ipc-common.h"
+#include "android/hal-ipc.h"
+
+static const char HAL_SK_PATH[] = "\0test_hal_ipc_socket";
+
+static void test_init(void)
+{
+	g_assert(hal_ipc_init(HAL_SK_PATH, sizeof(HAL_SK_PATH)));
+
+	hal_ipc_cleanup();
+
+	g_assert(hal_ipc_init(HAL_SK_PATH, sizeof(HAL_SK_PATH)));
+
+	hal_ipc_cleanup();
+}
+
+int main(int argc, char *argv[])
+{
+	g_test_init(&argc, &argv, NULL);
+
+	if (!g_test_verbose())
+		fclose(stderr);
+
+	g_test_add_func("/android_hal_ipc/init", test_init);
+
+	return g_test_run();
+}
-- 
1.9.3


  parent reply	other threads:[~2014-08-19 19:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-19 19:51 [PATCH 01/11] android/hal-ipc: Refactor handling of IPC error Szymon Janc
2014-08-19 19:51 ` [PATCH 02/11] android/hal-ipc: Use IPC constants for return codes Szymon Janc
2014-08-19 19:51 ` [PATCH 03/11] android/hal-ipc: Allow to set custom thread and disconnect callbacks Szymon Janc
2014-08-19 19:51 ` [PATCH 04/11] android/hal-ipc: Constify param parameter Szymon Janc
2014-08-19 19:51 ` Szymon Janc [this message]
2014-08-19 19:51 ` [PATCH 06/11] android/test: Add HAL IPC accept test Szymon Janc
2014-08-19 19:51 ` [PATCH 07/11] android/test: Add HAL IPC thread callback test Szymon Janc
2014-08-19 19:51 ` [PATCH 08/11] android/test: Add HAL IPC disconnect tests Szymon Janc
2014-08-19 19:51 ` [PATCH 09/11] android/test: Add HAL IPC reconnect tests Szymon Janc
2014-08-19 19:51 ` [PATCH 10/11] android/test: Add HAL IPC command tests Szymon Janc
2014-08-19 19:51 ` [PATCH 11/11] doc: Add Android test-hal-ipc test numbers to coverage list Szymon Janc
2014-08-20 10:38 ` [PATCH 01/11] android/hal-ipc: Refactor handling of IPC error Luiz Augusto von Dentz
2014-08-20 11:22   ` Szymon Janc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1408477872-24160-5-git-send-email-szymon.janc@tieto.com \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.