fgof-proc-test Public
Code
Use Git or checkout with SVN using the web URL.
No matching headings.
fgof-proc-test
Process-test fixtures for modern Fortran.
fgof-proc-test is intended to be a small, standalone library for building
reliable process-level tests around command-line tools, daemons, and helper
programs.
It is part of the FortranGoingOnForty lib-modules
catalog, but it is intended to stand on its own as a normal fpm package.
Current v1 target:
- build on
fgof-processinstead of re-implementing subprocess control - expose fixture options and process-fixture state
- support stable setup, start, readiness, retry, and cleanup flows
- stay focused on process-level testing, not general assertion frameworks
Future scope:
- expect-backed fixtures layered on top of
fgof-expect - richer assertions and transcript snapshots
- higher-level scenario runners layered on top of the stable core
Status
Fixture lifecycle, setup hooks, and first assertion layer are in place.
Tracked today:
- public
fgof_proc_testandfgof_proc_test_typesmodules make_fixture(),run_fixture(), andcleanup_fixture()lifecycle helpers- optional setup commands plus cleanup-on-failure behavior
- readiness checks, retry tracking, and captured last-result state
- assertion helpers for exit codes and output checks
fixture_diagnostics()for richer failure detail- retry-delay support plus
retry_fixture()convenience - tracked examples for setup/cleanup and assertion flows
- diagnostics include setup, main-command, and cleanup transcript slices
- initial fixture and options types
- stable error constants with naming helpers
- CI and
fpm testbaseline wiring
Why Use It
- process-level tests are still a repeated pain point in Fortran tooling
fgof-processnow gives us a strong base to build a cleaner fixture layer- many integration suites still hand-roll setup, polling, teardown, and cleanup
- a focused package here can make app and tool testing much less fragile
- current fixtures work well for one-shot process checks and reusable setup or
teardown steps even before
fgof-processgrows async handles - assertion helpers keep common exit-code and output checks close to the fixture state instead of scattering them through each test file
- diagnostics make failed fixtures much easier to inspect without rebuilding the context in every test
Public API Shape
Primary modules:
fgof_proc_testfgof_proc_test_types
Public types:
fixture_optionsprocess_fixture
Public constants:
FGOF_PROC_TEST_OKFGOF_PROC_TEST_ERR_INVALID_OPTIONSFGOF_PROC_TEST_ERR_SPAWN_FAILEDFGOF_PROC_TEST_ERR_READINESS_FAILEDFGOF_PROC_TEST_ERR_SETUP_FAILEDFGOF_PROC_TEST_ERR_CLEANUP_FAILEDFGOF_PROC_TEST_ERR_ASSERTION_FAILEDFGOF_PROC_TEST_ERR_INTERNAL
Current public procedures:
assert_fixture_exit_codeassert_fixture_output_containsassert_fixture_stderr_containsassert_fixture_stdout_containsassert_fixture_successcleanup_fixtureclear_fixture_optionsclear_process_fixturefixture_diagnosticsfixture_readyfixture_resultmake_fixtureproc_test_backend_nameproc_test_error_nameretry_fixturerun_fixture
Quick Start
program demo_proc_test
use fgof_process, only : shell
use fgof_proc_test, only : &
cleanup_fixture, clear_fixture_options, fixture_diagnostics, &
fixture_ready, make_fixture, run_fixture
use fgof_proc_test_types, only : fixture_options, process_fixture
implicit none
type(fixture_options) :: options
type(process_fixture) :: fixture
options = clear_fixture_options()
options%ready_text = "READY"
options%retry_delay_ms = 10
fixture = make_fixture( &
"demo", &
shell("printf READY"), &
options, &
cleanup_cmd=shell("printf CLEANED >/dev/null"), &
setup_cmd=shell("printf MADE >/dev/null"))
if (run_fixture(fixture)) then
if (fixture_ready(fixture)) print *, "fixture is ready"
else
print *, trim(fixture_diagnostics(fixture))
end if
if (.not. cleanup_fixture(fixture)) then
print *, fixture%error_message
end if
end program demo_proc_test
Build And Test
fpm test
That is the baseline verification command locally and in CI.
Example binaries are also tracked under example/:
setup_cleanup_demoassertion_demo
CI also executes the tracked examples after the test suite so the documented paths stay exercised.
Supported Platforms
- macOS
- Linux
Boundaries
- intended to stay independently versioned and releasable
- focused on process-fixture ergonomics, not full test-framework replacement
- should sit cleanly beside
test-drive,vegetables, or other assertion layers fgof-processremains the subprocess backend underneath this package- current fixtures are synchronous and one-shot; persistent daemons and richer async supervision should wait for later backend support
- assertion helpers are intentionally simple string and exit-code checks for now
- richer transcript assertions and expect-backed fixtures can sit above this package later
License
MIT