summaryrefslogtreecommitdiff
blob: 074dd857076f2a2e3e269bbcce8b2cbf92484297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
https://bugs.gentoo.org/896106
https://github.com/festvox/flite/pull/90

From 1f26195418fbe8915f48bb51e1e6126f531ecc25 Mon Sep 17 00:00:00 2001
From: matoro <matoro@users.noreply.github.com>
Date: Fri, 24 Feb 2023 14:25:16 -0500
Subject: [PATCH] Expose automated tests under "make check"

The following unit tests can be run automatically without specifying any
user-provided arguments:
hrg_test lex_test multi_thread nums_test regex_test token_test

Fix up the Makefiles to expose the ability to run these tests via "make
check" or "make test", since it is currently broken (exposed at the top
level, but missing the "test" target in testsuite/).
---
 Makefile           |  2 +-
 testsuite/Makefile | 22 ++++++++++++----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 511f8cf..1b627b2 100644
--- a/Makefile
+++ b/Makefile
@@ -129,6 +129,6 @@ voices: ./bin/flite_cmu_us_awb ./bin/flite_cmu_us_rms ./bin/flite_cmu_us_rms
 	./bin/flite_cmu_us_rms -voicedump voices/cmu_us_rms.flitevox
 	./bin/flite_cmu_us_slt -voicedump voices/cmu_us_slt.flitevox
 
-test:
+check test:
 	@ $(MAKE) --no-print-directory -C testsuite test
 
diff --git a/testsuite/Makefile b/testsuite/Makefile
index b60e98a..8b1163c 100644
--- a/testsuite/Makefile
+++ b/testsuite/Makefile
@@ -49,15 +49,17 @@ SRCS = token_test_main.c hrg_test_main.c \
        bin2ascii_main.c record_in_noise_main.c \
        compare_wave_main.c rfc_main.c lpc_resynth_main.c \
        by_word_main.c flite_test_main.c \
-       dcoffset_wave_main.c tris1_main.c
+       dcoffset_wave_main.c tris1_main.c \
+       multi_thread_main.c
 FC = us.flitecheck indic_hin.flitecheck indic_tam.flitecheck
-OTHERS = kal_test_main.c multi_thread_main.c 
+OTHERS = kal_test_main.c
 
 FILES = Makefile $(SRCS) $(DATAFILES) $(OTHERS) $(FC)
 
 LOCAL_INCLUDES = -I$(TOP)/lang/usenglish
 
 MAIN_EXECS = $(SRCS:_main.c=$(EXEEXT))
+AUTO_EXECS = hrg_test lex_test multi_thread nums_test regex_test token_test
 lex_test_LIBS = -lflite_cmulex
 nums_test_LIBS = -lflite_usenglish
 utt_test_LIBS = -lflite_cmulex
@@ -65,6 +67,7 @@ lex_lookup_LIBS = -lflite_cmulex
 ldom_time_LIBS = -L/home/awb/data/ldom/time_flite/flite/lib -lcmu_time_awb -lflite_usenglish -lflite_cmulex
 flite_test_LIBS = -lflite_usenglish -lflite_cmulex
 by_word_LIBS = -lflite_cmu_us_kal -lflite_usenglish -lflite_cmulex
+multi_thread_LIBS = -lflite_cmu_us_slt -lflite_cmulex -lflite_usenglish -lflite -lm -lasound -lgomp
 #kal_test_LIBS = -lflite_cmu_us_kal -lflite_usenglish -lflite_cmulex \
 #	          /home/awb/src/malloc/gmalloc.o
 
@@ -73,19 +76,18 @@ LOCAL_CLEAN = $(MAIN_EXECS)
 
 include $(TOP)/config/common_make_rules
 
+multi_thread : CFLAGS += -fopenmp
+
 MAIN_O = $(SRCS:%=%_main.o)
 $(MAIN_O) : %_main.o : %_main.c
 	$(CC) $(CFLAGS) -o $@ $< 
 $(MAIN_EXECS) : %$(EXEEXT) : %_main.o $(FLITELIBS)
 	$(CC) $(CFLAGS) -o $@ $@_main.o $($(@:=_LIBS)) $(FLITELIBFLAGS) $(LDFLAGS)
 
-multi_thread: multi_thread_main.c
-	gcc -fopenmp -o multi_thread multi_thread_main.c \
-		$(CFLAGS) -I$(TOP)/include $(FLITELIBFLAGS) $(LDFLAGS) \
-		-l flite_cmu_us_slt -lflite_cmulex -lflite_usenglish \
-		-lflite -lm -lasound -lgomp
-do_thread_test: multi_thread
-#	This shouldn't segfault
-	export OMP_NUM_THREADS=100 && ./multi_thread
+check test: $(patsubst %, run_%, $(AUTO_EXECS))
 
+run_%: %
+	LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(LIBDIR)" ./$<
 
+run_multi_thread: multi_thread
+	LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(LIBDIR)" OMP_NUM_THREADS=100 ./$<