aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-10-31 17:11:09 (GMT)
committerJouni Malinen <j@w1.fi>2015-10-31 19:56:59 (GMT)
commit1f1e61928273e10b0595eea637071f09729cb1c0 (patch)
tree52cf6f6a638d88667fa6d2227d8859a2f54dad3b /wpa_supplicant
parent736b7cb2daf877a0cb9ad42ff15a2efbbd65fa42 (diff)
downloadhostap-1f1e61928273e10b0595eea637071f09729cb1c0.zip
hostap-1f1e61928273e10b0595eea637071f09729cb1c0.tar.gz
hostap-1f1e61928273e10b0595eea637071f09729cb1c0.tar.bz2
Add test programs for checking libwpa_client linking
libwpa_test1 and libwpa_test2 targets can now be used to check libwpa_client linking for static and shared library cases respectively. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/Makefile9
-rw-r--r--wpa_supplicant/tests/libwpa_test.c32
2 files changed, 41 insertions, 0 deletions
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index ad7dd8d..86bdfc6 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -1722,6 +1722,14 @@ libwpa_client.so: $(LIBCTRLSO)
@$(E) " CC $@ ($^)"
$(Q)$(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -fPIC $^
+libwpa_test1: tests/libwpa_test.o libwpa_client.a
+ $(Q)$(LDO) $(LDFLAGS) -o libwpa_test1 tests/libwpa_test.o libwpa_client.a $(LIBS_c)
+ @$(E) " LD " $@
+
+libwpa_test2: tests/libwpa_test.o libwpa_client.so
+ $(Q)$(LDO) $(LDFLAGS) -o libwpa_test2 tests/libwpa_test.o -L. -lwpa_client $(LIBS_c)
+ @$(E) " LD " $@
+
link_test: $(OBJS) $(OBJS_h) tests/link_test.o
$(Q)$(LDO) $(LDFLAGS) -o link_test $(OBJS) $(OBJS_h) tests/link_test.o $(LIBS)
@$(E) " LD " $@
@@ -1843,5 +1851,6 @@ clean:
rm -rf lcov-html
rm -f libwpa_client.a
rm -f libwpa_client.so
+ rm -f libwpa_test1 libwpa_test2
-include $(OBJS:%.o=%.d)
diff --git a/wpa_supplicant/tests/libwpa_test.c b/wpa_supplicant/tests/libwpa_test.c
new file mode 100644
index 0000000..e51ab72
--- /dev/null
+++ b/wpa_supplicant/tests/libwpa_test.c
@@ -0,0 +1,32 @@
+/*
+ * libwpa_test - Test program for libwpa_client.* library linking
+ * Copyright (c) 2015, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#include "includes.h"
+
+#include "common/wpa_ctrl.h"
+
+int main(int argc, char *argv[])
+{
+ struct wpa_ctrl *ctrl;
+
+ ctrl = wpa_ctrl_open("foo");
+ if (!ctrl)
+ return -1;
+ if (wpa_ctrl_attach(ctrl) == 0)
+ wpa_ctrl_detach(ctrl);
+ if (wpa_ctrl_pending(ctrl)) {
+ char buf[10];
+ size_t len;
+
+ len = sizeof(buf);
+ wpa_ctrl_recv(ctrl, buf, &len);
+ }
+ wpa_ctrl_close(ctrl);
+
+ return 0;
+}