Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame^] | 1 | Do not use the JD_TERMCAP macro since we cannot get the terminfo from |
| 2 | ncurses pkg-config, but fix the macro to not reference host directories. |
| 3 | Also add src/test/Makefile.in so that we can use -ltermcap if we want to. |
| 4 | |
| 5 | Upstream-Status: Pending |
| 6 | |
| 7 | Signed-off-by: Joe Slater <joe.slater@windriver.com> |
| 8 | |
| 9 | |
| 10 | --- a/autoconf/aclocal.m4 |
| 11 | +++ b/autoconf/aclocal.m4 |
| 12 | @@ -506,14 +506,10 @@ then |
| 13 | else |
| 14 | MISC_TERMINFO_DIRS="" |
| 15 | fi |
| 16 | -JD_Terminfo_Dirs="$MISC_TERMINFO_DIRS \ |
| 17 | - /usr/lib/terminfo \ |
| 18 | - /usr/share/terminfo \ |
| 19 | - /usr/share/lib/terminfo \ |
| 20 | - /usr/local/lib/terminfo" |
| 21 | + |
| 22 | TERMCAP=-ltermcap |
| 23 | |
| 24 | -for terminfo_dir in $JD_Terminfo_Dirs |
| 25 | +for terminfo_dir in $MISC_TERMINFO_DIRS |
| 26 | do |
| 27 | if test -d $terminfo_dir |
| 28 | then |
| 29 | --- a/autoconf/configure.ac |
| 30 | +++ b/autoconf/configure.ac |
| 31 | @@ -249,7 +249,14 @@ AC_CHECK_SIZEOF(size_t) |
| 32 | JD_CHECK_LONG_LONG |
| 33 | JD_LARGE_FILE_SUPPORT |
| 34 | |
| 35 | -JD_TERMCAP |
| 36 | +dnl Do not use JD_TERMCAP, since we cannot get terminfo from ncurses*-config anymore. |
| 37 | +dnl Set TERMCAP=-ltermcap and AC_DEFINE(USE_TERMCAP,1,[Define to use termcap]) |
| 38 | +dnl to use libtermcap. |
| 39 | +TERMCAP="" |
| 40 | +MISC_TERMINFO_DIRS="" |
| 41 | +AC_SUBST(TERMCAP)dnl |
| 42 | +AC_SUBST(MISC_TERMINFO_DIRS)dnl |
| 43 | + |
| 44 | JD_GCC_WARNINGS |
| 45 | |
| 46 | JD_SET_OBJ_SRC_DIR(src) |
| 47 | @@ -364,7 +371,7 @@ AC_CONFIG_HEADER(src/sysconf.h:src/confi |
| 48 | dnl AC_CONFIG_SUBDIRS(demo) |
| 49 | |
| 50 | AC_OUTPUT(Makefile:autoconf/Makefile.in \ |
| 51 | - src/Makefile slsh/Makefile modules/Makefile demo/Makefile \ |
| 52 | + src/Makefile src/test/Makefile slsh/Makefile modules/Makefile demo/Makefile \ |
| 53 | slang.pc:autoconf/slangpc.in \ |
| 54 | ) |
| 55 | |
| 56 | --- /dev/null |
| 57 | +++ b/src/test/Makefile.in |
| 58 | @@ -0,0 +1,90 @@ |
| 59 | +# -*- make -*- |
| 60 | +TEST_SCRIPTS_SLC = argv syntax scircuit eqs sscanf loops arith array strops \ |
| 61 | + bstring pack stdio assoc selfload struct nspace path ifeval anytype arrmult \ |
| 62 | + time utf8 except bugs list regexp method deref naninf overflow sort \ |
| 63 | + longlong signal dollar req docfun debug qualif compare break multline \ |
| 64 | + stack misc posixio posdir proc math |
| 65 | + |
| 66 | +TEST_SCRIPTS_NO_SLC = autoload nspace2 prep |
| 67 | + |
| 68 | +TEST_SCRIPTS = $(TEST_SCRIPTS_SLC) $(TEST_SCRIPTS_NO_SLC) |
| 69 | + |
| 70 | +TEST_PGM = sltest |
| 71 | +MEMCHECK = valgrind --tool=memcheck --leak-check=yes --leak-resolution=med --num-callers=20 |
| 72 | +RUN_TEST_PGM = ./$(TEST_PGM) |
| 73 | +SLANGINC = .. |
| 74 | +SLANGLIB = ../$(ARCH)objs |
| 75 | +OTHER_LIBS = -lm @TERMCAP@ |
| 76 | +OTHER_CFLAGS = |
| 77 | + |
| 78 | +runtests: $(TEST_PGM) cleantmp |
| 79 | + @tests=""; \ |
| 80 | + for test in $(TEST_SCRIPTS); \ |
| 81 | + do \ |
| 82 | + tests="$$tests $$test.sl"; \ |
| 83 | + done; \ |
| 84 | + for test in $(TEST_SCRIPTS_SLC); \ |
| 85 | + do \ |
| 86 | + tests="$$tests $$test.slc"; \ |
| 87 | + done; \ |
| 88 | + MAKERUNNING=1 ./runtests.sh $$tests |
| 89 | +# @touch $(TEST_PGM).c |
| 90 | + |
| 91 | +update: $(TEST_PGM) cleantmp |
| 92 | + @tests=""; \ |
| 93 | + for X in $(TEST_SCRIPTS); \ |
| 94 | + do \ |
| 95 | + if [ ! -e lastrun/$$X.sl ] || [ $$X.sl -nt lastrun/$$X.sl ] ; \ |
| 96 | + then \ |
| 97 | + tests="$$tests $$X.sl"; \ |
| 98 | + fi \ |
| 99 | + done; \ |
| 100 | + for X in $(TEST_SCRIPTS_SLC); \ |
| 101 | + do \ |
| 102 | + if [ ! -e lastrun/$$X.slc ] || [ $$X.sl -nt lastrun/$$X.slc ] ; \ |
| 103 | + then \ |
| 104 | + tests="$$tests $$X.slc"; \ |
| 105 | + fi \ |
| 106 | + done; \ |
| 107 | + if test -n "$$tests"; \ |
| 108 | + then \ |
| 109 | + MAKERUNNING=1 ./runtests.sh $$tests; \ |
| 110 | + fi |
| 111 | +# @touch $(TEST_PGM).c |
| 112 | + |
| 113 | +memcheck_runtests: $(TEST_PGM) cleantmp |
| 114 | + @echo "" |
| 115 | + @echo "Running tests:" |
| 116 | + @echo "" |
| 117 | + -@for X in $(TEST_SCRIPTS); \ |
| 118 | + do \ |
| 119 | + $(MEMCHECK) --log-file=log.$${X} $(RUN_TEST_PGM) $$X.sl; \ |
| 120 | + grep ERROR log.$${X}; grep 'lost: [^0]' log.$${X}; \ |
| 121 | + $(MEMCHECK) --log-file=log.$${X}_u $(RUN_TEST_PGM) -utf8 $$X.sl; \ |
| 122 | + grep ERROR log.$${X}_u; grep 'lost: [^0]' log.$${X}_u; \ |
| 123 | + done |
| 124 | +# touch $(TEST_PGM).c |
| 125 | + |
| 126 | +memcheck_runtests_slc: $(TEST_PGM) cleantmp |
| 127 | + @echo "" |
| 128 | + @echo "Running tests:" |
| 129 | + @echo "" |
| 130 | + -@for X in $(TEST_SCRIPTS_SLC); \ |
| 131 | + do \ |
| 132 | + $(MEMCHECK) --log-file=log.$${X}_c $(RUN_TEST_PGM) $$X.slc; \ |
| 133 | + $(MEMCHECK) --log-file=log.$${X}_uc $(RUN_TEST_PGM) -utf8 $$X.slc; \ |
| 134 | + done |
| 135 | +# touch $(TEST_PGM).c |
| 136 | + |
| 137 | +memcheck: memcheck_runtests memcheck_runtests_slc |
| 138 | + |
| 139 | +$(TEST_PGM): $(TEST_PGM).c assoc.c list.c $(SLANGLIB)/libslang.a |
| 140 | + $(CC) $(CFLAGS) $(OTHER_CFLAGS) $(LDFLAGS) $(TEST_PGM).c -o $(TEST_PGM) -I$(SLANGINC) -L$(SLANGLIB) -lslang $(OTHER_LIBS) |
| 141 | +cleantmp: |
| 142 | + -/bin/rm -rf tmpfile*.* tmpdir*.* |
| 143 | +clean: cleantmp |
| 144 | + -/bin/rm -f *~ *.o *.log log.pid* *.slc log.* *.log-* |
| 145 | +distclean: clean |
| 146 | + /bin/rm -f $(TEST_PGM) $(TEST_PGM).gcda $(TEST_PGM).gcno |
| 147 | +.PHONY: clean memcheck runtests memcheck_runtests_slc memcheck_runtests cleantmp |
| 148 | + |