# README.Debian for autopkgtest-helper ## Contributing modules `autopkgtest-helper` is intended to be a team effort. The library is deliberately modular: common functionality belongs in `fixtures.sh`, while functionality specific to a particular service or type of test should be implemented as a separate module under `lib/modules/`. Contributions of new modules and improvements to existing ones are welcome. Please open a merge request on [Salsa](https://salsa.debian.org/) for proposed changes. If you intend to contribute regularly, consider joining the team by subscribing to the package on [tracker.debian.org](https://tracker.debian.org/pkg/autopkgtest-helper). autopkgtest-helper@packages.debian.org also serves as a communications medium for the team.. When adding a module, please follow these guidelines: - Put the implementation in `lib/modules/.sh`. - Use the `fx_` namespace for all public functions and module-specific variables. - Keep the implementation POSIX shell compatible and shellcheck clean. - Use the core facilities for temporary files, daemon management, readiness checks, logging and teardown rather than implementing these mechanisms independently. - Call `fx_require` for external programs needed by the module. This ensures that missing dependencies are detected early and reported with an actionable error message. - Make sure that everything created by the module is confined to `$FX_ROOT` where possible and is cleaned up reliably. - Register cleanup actions with `fx_defer` or use the appropriate core functions for managing daemons. - Export environment variables that consumers need to interact with the service, and document them in the module's manual page section. - Add an autopkgtest exercising the module itself under `debian/tests/`, including failure and cleanup cases where appropriate. - Update the manual page `doc/autopkgtest-helper.7` to document the new module and its functions. Modules should be self-contained and should not interfere with system services or other tests running in the same testbed. ## Runtime dependencies The package deliberately does not declare `Depends`, `Recommends` or `Suggests` on programs that are only needed by particular modules or optional functions. This is intentional. Autopkgtest testbeds are often kept minimal, and installing dependencies for every available module would unnecessarily pull in packages that a particular test does not need. Instead, modules check for their required programs at run-time. Missing dependencies result in a helpful error message identifying the missing program, the package providing it, and the corresponding `Depends:` entry to add to the test stanza in `debian/tests/control`. Optional functionality also checks its requirements when invoked. For example, certificate generation checks for `openssl` only when `fx_cert` is called. Consumers must therefore declare the dependencies they actually need in the `Depends:` field of their individual autopkgtest test stanza. They should not rely on `autopkgtest-helper` to install module-specific dependencies. ## API and versioning policy `autopkgtest-helper` is currently in the 0.x development phase. During this phase, breaking changes to the library API, function interfaces or behaviour may be introduced at any time, including between minor releases. Consumers should not assume API stability across 0.x versions. New modules and breaking changes will increase the major release number. This allows consumers that require a particular module to declare a versioned dependency on `autopkgtest-helper` in their `debian/tests/control`, for example: Depends: autopkgtest-helper (>= X), ... Here, `X` is the version in which the required module was introduced. This ensures that the testbed contains a version of the helper library that provides the module the test needs. The introduction of additional functions to an existing module does not necessarily imply a new major release number, unless otherwise required by compatibility considerations. ## TODO items The following things have not been implemented yet but flagged as "nice to have" for a future version. People considering contributing without a clear idea might want to try these. Capture log also on a testbed that has a real /dev/log, by moving it away and putting it back at teardown. The pieces are there: fx_backup restores a symlink or socket, and fx_defer runs in re‐ verse order. Be careful: while the test runs the real logger gets nothing, with systemd /dev/log is a symlink into /run/systemd/jour‐ nal, and a developer who runs the tests from a checkout on a work‐ station will not want this. It has to be opt-in, and it should refuse unless it runs as root and is told so explicitly. Key types other than RSA 2048, for example rsa:4096, ec:prime256v1 and ed25519. openssl req -newkey takes rsa:N, ed25519 and ec -pkeyopt ec_paramgen_curve:prime256v1. The key usage keyEncipher‐ ment that fx_cert writes is valid for RSA keys only and has to be left out for the others, or strict TLS stacks reject the certifi‐ cate. EC keys are much faster to generate, which matters when a test creates many certificates. --pem, --chain, --p12 password: Other output formats: key and certificate in one file (mode 0600); the certificate followed by the certificates of its issuing inter‐ mediates (what most servers want, and what makes fx_ca --parent re‐ ally convenient); PKCS#12 for Java and Windows clients (openssl pkcs12 -export). OpenSSL 3 writes PKCS#12 with algorithms that older libraries cannot read unless -legacy or explicit -certpbe, -keypbe and -macalg are used.