polserver/cmake/core_tests_start.cmake
Kevin Eady 1ad7d240eb
Add module function os::SendEmail (#793)
* wip implementation

* maybe add tests...

* fix dependencies

* fix windows and mac deps

* attempt #3 for mac deps

* add --break-system-packages because WHY NOT

* add raii wrapper for curl_slist and curl_mime

* add content_type; fix incorrect recipient variable; more tests

* put smtpd log in file; add curl_easy_setopt_return_error; fix parsing email from display string

* remove some debugging

* catch exceptions in polsys::ReloadConfiguration; tests; smtpd cleanup

* Fix xslt validation erorrs in osem.xml
- `HTTPRequest`` did not have the `<code>` block inside `<explain>` so
it was not rendered.
- `LoadExportedScript` needed `<return>` after `<explain>`
- `GetEnvironmentVariable` needed `<return>` after `<explain>`

* Address review comments
- remove openssl test dep by generating cert, valid for 100 years
- only run test if asiosmtpd module is installed

* Address review comments
- remove `pChild`
- remove `curl_easy_setopt_return_error` macro
- return `new BLong( 0 )` for temp object replaced by background thread

* Address review comments
- use `Clib::localtime` + `fmt::format` for date header

* Address review comments
- Early exit on failures

* Address review comments
- Move suspend to immediately before background thread creation

* Address review comments
- better handling of curl_slist and curl_mimes

* Address Discord comments
- remove env check in test_email program

* attempt to fix timezone issue in date header

* additional tests for invalid params

* add docs, core changes

* smtpd: fix event loop, only run if not filtered out

* put stacktrace in "no signal received" error

* fix stacktrace call in testutil; add default param to os.environ.get in smtpd
2025-07-03 21:33:36 +02:00

24 lines
664 B
CMake

find_package(Python3 COMPONENTS Interpreter REQUIRED QUIET)
if(testemail)
execute_process(
COMMAND ${Python3_EXECUTABLE} ${testdir}/testclient/pyuo/testclient.py
COMMAND ${Python3_EXECUTABLE} ${testdir}/smtpd/smtpd.py
COMMAND ${pol}
COMMAND_ECHO STDOUT
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE res
TIMEOUT 600
)
else()
execute_process(
COMMAND ${Python3_EXECUTABLE} ${testdir}/testclient/pyuo/testclient.py
COMMAND ${pol}
COMMAND_ECHO STDOUT
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE res
TIMEOUT 600
)
endif()
if(NOT "${res}" STREQUAL "0")
message(SEND_ERROR "${res}")
endif()