tests: cover live ibus transport lifecycle

This commit is contained in:
2026-08-13 23:55:27 +09:00
parent 88d26c598d
commit f399eb0af6
5 changed files with 1026 additions and 4 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
/strans /strans
/tests/*.o /tests/*.o
/tests/unit_test /tests/unit_test
/tests/ibus_live_test
/xim/*.o /xim/*.o
/xim/strans-xim /xim/strans-xim
/xim/xim_test /xim/xim_test

View File

@@ -19,6 +19,7 @@ RUN pacman -Syu --noconfirm --needed \
&& pacman -Scc --noconfirm && pacman -Scc --noconfirm
RUN printf "egrep='grep -E'\n" > /usr/lib/plan9/config RUN printf "egrep='grep -E'\n" > /usr/lib/plan9/config
RUN dbus-uuidgen --ensure=/etc/machine-id
ENV PLAN9=/usr/lib/plan9 ENV PLAN9=/usr/lib/plan9
ENV PATH=$PATH:/usr/lib/plan9/bin ENV PATH=$PATH:/usr/lib/plan9/bin

View File

@@ -56,7 +56,7 @@ docker: docker-image
check: verify-map test check: verify-map test
$(MAKE) -C xim check $(MAKE) -C xim check
test: test: $(PROG)
$(MAKE) -C tests check TESTARGS="$(TESTARGS)" $(MAKE) -C tests check TESTARGS="$(TESTARGS)"
verify-map: verify-map:

View File

@@ -1,5 +1,6 @@
CC = 9c CC = 9c
LD = 9l LD = 9l
HOSTCC = cc
CFLAGS = -std=c99 -Wall -Wextra -O2 -g -I.. -I../cutest CFLAGS = -std=c99 -Wall -Wextra -O2 -g -I.. -I../cutest
FT_CFLAGS = $(shell pkg-config --cflags freetype2) FT_CFLAGS = $(shell pkg-config --cflags freetype2)
FT_LIBS = $(shell pkg-config --libs freetype2) FT_LIBS = $(shell pkg-config --libs freetype2)
@@ -8,6 +9,7 @@ IBUS_LIBS = $(shell pkg-config --libs dbus-1 xkbcommon)
LIBS = -lthread -lbio $(FT_LIBS) $(IBUS_LIBS) LIBS = -lthread -lbio $(FT_LIBS) $(IBUS_LIBS)
PROG = unit_test PROG = unit_test
LIVE = ibus_live_test
TESTSRC = unit_test.c test_util.c str_test.c hash_test.c trie_test.c \ TESTSRC = unit_test.c test_util.c str_test.c hash_test.c trie_test.c \
ko_test.c vi_test.c engine_test.c dict_test.c ipc_test.c \ ko_test.c vi_test.c engine_test.c dict_test.c ipc_test.c \
popup_test.c font_test.c ibus_test.c server_test.c popup_test.c font_test.c ibus_test.c server_test.c
@@ -17,14 +19,18 @@ PARENTSRC = str.c hash.c trie.c dict.c ko.c vi.c ipc.c popup_layout.c \
PARENTOBJ = $(PARENTSRC:%.c=unit_%.o) PARENTOBJ = $(PARENTSRC:%.c=unit_%.o)
OBJS = $(TESTOBJ) $(PARENTOBJ) OBJS = $(TESTOBJ) $(PARENTOBJ)
all: $(PROG) all: $(PROG) $(LIVE)
check test: $(PROG) check test: $(PROG) $(LIVE)
./$(PROG) $(TESTARGS) ./$(PROG) $(TESTARGS)
./ibus_live_test ../strans ../map
$(PROG): $(OBJS) $(PROG): $(OBJS)
$(LD) -o $@ $(OBJS) $(LIBS) $(LD) -o $@ $(OBJS) $(LIBS)
ibus_live_test: ibus_live_test.c
$(HOSTCC) -std=c99 -Wall -Wextra -O2 -g $(IBUS_CFLAGS) -o $@ $< $(IBUS_LIBS)
$(TESTOBJ): test.h ../dat.h ../fn.h ../ipc.h ../cutest/cutest.h $(TESTOBJ): test.h ../dat.h ../fn.h ../ipc.h ../cutest/cutest.h
engine_test.o: ../strans.c engine_test.o: ../strans.c
ibus_test.o: CFLAGS += $(IBUS_CFLAGS) ibus_test.o: CFLAGS += $(IBUS_CFLAGS)
@@ -39,6 +45,6 @@ unit_%.o: ../%.c ../dat.h ../fn.h ../ipc.h
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
clean: clean:
rm -f $(OBJS) $(PROG) rm -f $(OBJS) $(PROG) $(LIVE)
.PHONY: all check test clean .PHONY: all check test clean

1014
tests/ibus_live_test.c Normal file

File diff suppressed because it is too large Load Diff