Commit Graph

34 Commits

Author SHA1 Message Date
Michael Vetter
ee0d325648 tests: add prof_send_raw
Allow sending byte sequences to the Profanity PTY without a newline.
Now we can simulate control characters, specifically the `TAB` key
(`\t`), to trigger autocompletion.
2026-03-19 08:50:58 +01:00
Michael Vetter
833090aac5 chore: Add copyright header to C files who had none 2026-03-09 13:14:44 +01:00
Michael Vetter
778a9b3d3d tests: Don't build functional test with analyzer and increase timeouts 2026-03-06 11:01:18 +01:00
Michael Vetter
5bc6604648 tests: remove apparently unused code 2026-03-06 09:02:09 +01:00
Michael Vetter
897e192544 ests: fix functional test rooms_query 2026-03-05 13:51:28 +01:00
Michael Vetter
d2d5f1489f tests: Fix passing of special characters to prof_expect()
We were passing our raw strings to the regex engine. We need to escape
them with g_regex_escape_string() first.
2026-03-05 13:11:59 +01:00
Michael Vetter
9cb11bdec2 tests: Reenable functional tests
They were disabled in 171b6e73c9.

Enable the functional test suite and replaces the
dependency on libexpect with a custom solution.

The native solution allows for specific optimizations like automatic
ANSI code stripping, which is essential for reliable pattern matching in
an ncurses interface.

Custom PTY management via libutil provides full control over the process
lifecycle, resolving issues where tests would hang indefinitely.
We use forkpty from libutil.

Addiiotnally this commit implements automatic ANSI escape sequence
filtering to improve matching consistency.
This will get rid of the colors in matches. It's still something that we
need to think about more since basically we will not test out
color/theme system this way.

We also add non-blocking poll() and SIGKILL based teardown logic to
ensure clean test termination.

We added the functional tests to both autotools and meson.
They are only build when tests are enabled and stabber + libutil are
present.
Meson will print this out nicely in the summary.

Regards https://github.com/profanity-im/profanity/issues/789
2026-03-04 22:32:38 +01:00
Michael Vetter
80e36bd1e2 tests: Apply coding style to unit tests 2026-02-28 14:52:36 +01:00
Steffen Jaeckel
65f5883fee Introduce tests/prof_cmocka.h
As 9f2abc75 accidentally got the ordering of some of the includes wrong,
I decided to propose my initial solution again.

Additional to that, I've opened a MR against CMocka to solve this on
their side, since I believe that the current way this is done is not
sustainable [0].

[0] https://gitlab.com/cmocka/cmocka/-/merge_requests/91

Fixes: 9f2abc75 ("Fix tests with gcc15 (uintptr_t)")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-08-06 15:52:33 +02:00
ike08
d35a7a7f7e Refactor tests to use the new cmocka test runner
## Summary

Fixes https://github.com/profanity-im/profanity/issues/1907  

Update functional and unit test code to comply with the current cmocka test runner.  

## Changes

- `UnitTest` struct to `CMUnitTest` struct
- `unit_test()` macro to `cmocka_unit_test(f)` macro
- `unit_test_setup_teardown()` macro to `cmocka_unit_test_setup_teardown` macro
- `run_tests()` macro to `cmocka_run_group_tests()` function
- Setup and teardown functions return `int` instead of `void`

## Testing

### Unit Tests

`make check`

### Functional Tests

I did not compile or run functional tests because they are *shelved* for now.

### Valgrind

I'm not entirely sure how to fun Valgrind in this case. I did not do fancy memory management, so it should be fine.
2023-11-01 18:30:08 -06:00
Michael Vetter
693fdcce65 functest: Make char const 2020-10-15 10:12:33 +02:00
Michael Vetter
12cafe4e60 Add include for waitpid to functionaltest 2020-06-04 12:02:02 +02:00
Michael Vetter
a28f0d9e74 Update tests with new URL
https://github.com/profanity-im/profanity/issues/1085
2019-05-03 10:46:41 +02:00
Paul Fariello
a952776b89 Rename mucconf wins into conf wins
Configuration windows are now being used by both muc and cmd.
2018-09-05 13:51:00 +02:00
James Booth
e043029a50 Allow clearing account resource
issue #880
2016-11-22 00:39:52 +00:00
James Booth
388a20813c Tests: disable occupants panel in functional tests 2016-09-26 00:39:37 +01:00
James Booth
69ac809776 Added functional tests for /console command 2015-12-30 00:32:52 +00:00
James Booth
7f98e013e1 Use single quotes in functional test stanzas 2015-12-30 00:12:24 +00:00
James Booth
9f34373b46 Disable muc notifications for functional tests 2015-12-20 02:57:01 +00:00
James Booth
cadaf73148 Fixed functional tests 2015-11-29 00:16:00 +00:00
James Booth
6640a0891f Force tls on all connections, add tls policy account property 2015-10-18 03:06:23 +01:00
James Booth
9c08211119 functionaltests: user ip address for server on connect 2015-10-13 00:45:10 +01:00
James Booth
118e92039e functionaltests: reset connect wait to 30 secs 2015-10-13 00:32:02 +01:00
James Booth
14ff1db9a6 functionaltests: Doubled libexpect timeout for connect 2015-10-13 00:24:28 +01:00
James Booth
e7b4f0bd78 Doubled expect timeout for connect in tests, removed libuuid from travis build 2015-10-13 00:10:28 +01:00
James Booth
e9aff68947 Fixed functional tests 2015-09-30 22:42:42 +01:00
James Booth
406b821b35 Show software version result in current window 2015-08-06 01:56:52 +01:00
James Booth
decd5066ce tests: prof_connect_with_roster takes items 2015-07-23 00:40:08 +01:00
James Booth
f9a7e35001 Added id attributes to roster queries
fixes #596
2015-07-22 22:48:37 +01:00
James Booth
f3326bf105 Added carbons enable/disable tests 2015-07-15 00:23:46 +01:00
James Booth
e50461a897 Set columns when running functional tests 2015-06-13 23:59:33 +01:00
James Booth
6255420b80 Increase connection time, functional tests 2015-06-13 19:49:26 +01:00
James Booth
a48b9fcec2 Tidied functional tests 2015-06-13 19:41:11 +01:00
James Booth
68ed20f10d Moved all tests to tests folder 2015-06-12 23:53:30 +01:00