aboutsummaryrefslogtreecommitdiff
path: root/tests/Makefile.am
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Makefile.am')
-rw-r--r--tests/Makefile.am28
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cf6237e..c39b2bb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,10 +1,30 @@
AM_CPPFLAGS = -I$(top_srcdir)/libusb
LDADD = ../libusb/libusb-1.0.la
-LIBS =
+AM_LDFLAGS = -static
-stress_SOURCES = stress.c libusb_testlib.h testlib.c
+stress_SOURCES = stress.c testlib.c
+stress_mt_SOURCES = stress_mt.c
+set_option_SOURCES = set_option.c testlib.c
+init_context_SOURCES = init_context.c testlib.c
+macos_SOURCES = macos.c testlib.c
-noinst_PROGRAMS = stress
+stress_mt_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
+stress_mt_LDADD = $(LDADD) $(THREAD_LIBS)
+stress_mt_LDFLAGS = $(AM_LDFLAGS)
+
+if OS_EMSCRIPTEN
+# On the Web you can't block the main thread as this blocks the event loop itself,
+# causing deadlocks when trying to use async APIs like WebUSB.
+# We use the PROXY_TO_PTHREAD Emscripten's feature to move the main app to a separate thread
+# where it can block safely.
+stress_mt_LDFLAGS += ${AM_LDFLAGS} -s PROXY_TO_PTHREAD -s EXIT_RUNTIME
+endif
+
+noinst_HEADERS = libusb_testlib.h
+noinst_PROGRAMS = stress stress_mt set_option init_context
+if OS_DARWIN
+noinst_PROGRAMS += macos
+endif
if BUILD_UMOCKDEV_TEST
# NOTE: We add libumockdev-preload.so so that we can run tests in-process
@@ -16,3 +36,5 @@ umockdev_SOURCES = umockdev.c
noinst_PROGRAMS += umockdev
endif
+
+TESTS=$(noinst_PROGRAMS)