From b4dd64a0c9e4aef2afb15412a7736958d0e74938 Mon Sep 17 00:00:00 2001 From: "jabber.developer2" Date: Sun, 21 Dec 2025 13:53:02 +0300 Subject: [PATCH] fix(tests): update functional tests to use regex assertions and increase timeout for expect operations --- Makefile.am | 5 ++++- tests/functionaltests/proftest.c | 31 +++++++++++++++++-------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0bd225aa..9de612f8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -297,13 +297,16 @@ tests_unittests_unittests_LDADD = -lcmocka # # Note: Debian/Ubuntu's libexpect requires -ltcl8.6 for linkage. +if HAVE_STABBER +if HAVE_EXPECT 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) -I/usr/include/tcl8.6 -I/usr/include/tcl8.5 tests_functionaltests_functionaltests_LDADD = -lcmocka -lstabber -lexpect -ltcl8.6 - +endif +endif man1_MANS = $(man1_sources) diff --git a/tests/functionaltests/proftest.c b/tests/functionaltests/proftest.c index d11c0004..ec01b45b 100644 --- a/tests/functionaltests/proftest.c +++ b/tests/functionaltests/proftest.c @@ -122,6 +122,9 @@ _cleanup_dirs(void) void prof_start(void) { + // Set timeout for expect operations (default is too short for CI) + exp_timeout = 30; + // helper script sets terminal columns, avoids assertions failing // based on the test runner terminal size fd = exp_spawnl("sh", @@ -169,36 +172,36 @@ init_prof_test(void **state) _create_logs_dir(); prof_start(); - assert_true(prof_output_exact("CProof. Type /help for help information.")); + assert_true(prof_output_regex("CProof\\. Type /help for help information\\.")); // set UI options to make expect assertions faster and more reliable prof_input("/inpblock timeout 5"); - assert_true(prof_output_exact("Input blocking set to 5 milliseconds")); + assert_true(prof_output_regex("Input blocking set to 5 milliseconds")); prof_input("/inpblock dynamic off"); - assert_true(prof_output_exact("Dynamic input blocking disabled")); + assert_true(prof_output_regex("Dynamic input blocking disabled")); prof_input("/notify chat off"); - assert_true(prof_output_exact("Chat notifications disabled")); + assert_true(prof_output_regex("Chat notifications disabled")); prof_input("/notify room off"); - assert_true(prof_output_exact("Room notifications disabled")); + assert_true(prof_output_regex("Room notifications disabled")); prof_input("/wrap off"); - assert_true(prof_output_exact("Word wrap disabled")); + assert_true(prof_output_regex("Word wrap disabled")); prof_input("/roster hide"); - assert_true(prof_output_exact("Roster disabled")); + assert_true(prof_output_regex("Roster disabled")); prof_input("/occupants default hide"); - assert_true(prof_output_exact("Occupant list disabled")); + assert_true(prof_output_regex("Occupant list disabled")); prof_input("/time console off"); prof_input("/time console off"); - assert_true(prof_output_exact("Console time display disabled.")); + assert_true(prof_output_regex("Console time display disabled\\.")); prof_input("/time chat off"); - assert_true(prof_output_exact("Chat time display disabled.")); + assert_true(prof_output_regex("Chat time display disabled\\.")); prof_input("/time muc off"); - assert_true(prof_output_exact("MUC time display disabled.")); + assert_true(prof_output_regex("MUC time display disabled\\.")); prof_input("/time config off"); - assert_true(prof_output_exact("Config time display disabled.")); + assert_true(prof_output_regex("Config time display disabled\\.")); prof_input("/time private off"); - assert_true(prof_output_exact("Private chat time display disabled.")); + assert_true(prof_output_regex("Private chat time display disabled\\.")); prof_input("/time xml off"); - assert_true(prof_output_exact("XML Console time display disabled.")); + assert_true(prof_output_regex("XML Console time display disabled\\.")); return 0; }