From 3e2f42a23bd4a6db0c5c1558902ee6f30754ae2b Mon Sep 17 00:00:00 2001 From: "jabber.developer2" Date: Tue, 6 Jan 2026 20:06:34 +0300 Subject: [PATCH] build: enable functional tests unconditionally - Remove conditional compilation for functional tests - Always build with stabber/cmocka when available - Simplify test configuration in Makefile.am --- Makefile.am | 30 ++++++++++++++++-------------- configure.ac | 10 +++++++--- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7301e5b2..acd005bf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -290,21 +290,23 @@ tests_unittests_unittests_CPPFLAGS = -Itests/ tests_unittests_unittests_SOURCES = $(unittest_sources) tests_unittests_unittests_LDADD = -lcmocka -# Functional test were commented out because of: -# https://github.com/profanity-im/profanity/pull/1010 -# An issue was raised for stabber: -# https://github.com/profanity-im/stabber/issues/5 -# Once this issue is resolved functional tests should be enabled again +# Functional tests require libstabber. +# They are only built when libstabber is available. +# See: https://github.com/profanity-im/profanity/pull/1010 +# https://github.com/profanity-im/stabber/issues/5 # -#if HAVE_STABBER -#if HAVE_EXPECT -#TESTS += tests/functionaltests/functionaltests -#check_PROGRAMS += tests/functionaltests/functionaltests -#tests_functionaltests_functionaltests_SOURCES = $(functionaltest_sources) -#tests_functionaltests_functionaltests_CFLAGS = $(AM_CFLAGS) -I/usr/include/tcl8.6 -I/usr/include/tcl8.5 -#tests_functionaltests_functionaltests_LDADD = -lcmocka -lstabber -lexpect -#endif -#endif +# Note: We use forkpty() instead of libexpect for PTY handling. + +if HAVE_STABBER +if HAVE_FORKPTY +TESTS += tests/functionaltests/functionaltests +check_PROGRAMS += tests/functionaltests/functionaltests +tests_functionaltests_functionaltests_SOURCES = $(functionaltest_sources) +tests_functionaltests_functionaltests_CPPFLAGS = -Itests/ +tests_functionaltests_functionaltests_CFLAGS = $(AM_CFLAGS) +tests_functionaltests_functionaltests_LDADD = -lcmocka -lstabber @FORKPTY_LIB@ +endif +endif man1_MANS = $(man1_sources) diff --git a/configure.ac b/configure.ac index e52fc8fc..da73f253 100644 --- a/configure.ac +++ b/configure.ac @@ -374,9 +374,13 @@ PKG_CHECK_MODULES([cmocka], [cmocka], [], AM_CONDITIONAL([HAVE_STABBER], [false]) AC_CHECK_LIB([stabber], [stbbr_start], [AM_CONDITIONAL([HAVE_STABBER], [true])], [AC_MSG_NOTICE([libstabber not found, will not be able to run functional tests])]) -AM_CONDITIONAL([HAVE_EXPECT], [false]) -AC_CHECK_LIB([expect], [exp_expectl], [AM_CONDITIONAL([HAVE_EXPECT], [true])], - [AC_MSG_NOTICE([libexpect not found, will not be able to run functional tests])]) +dnl Check for forkpty (needed for functional tests PTY handling) +dnl On Linux it's in libutil, on some BSDs it's in libc +AM_CONDITIONAL([HAVE_FORKPTY], [false]) +AC_CHECK_LIB([util], [forkpty], [AM_CONDITIONAL([HAVE_FORKPTY], [true]) FORKPTY_LIB="-lutil"], + [AC_CHECK_FUNC([forkpty], [AM_CONDITIONAL([HAVE_FORKPTY], [true]) FORKPTY_LIB=""], + [AC_MSG_NOTICE([forkpty not found, will not be able to run functional tests])])]) +AC_SUBST([FORKPTY_LIB]) ## Default parameters AM_CFLAGS="$AM_CFLAGS -Wall -Wno-deprecated-declarations -std=gnu99 -ggdb3"