Skip to content

Development

McDope edited this page Nov 3, 2024 · 8 revisions

Using the test suite when forking

There is a Github action defined to auto-execute the "can-actually-be-used" test suite on a Debian based system. It's not perfect, and doesn't test every thing possible - but, it's the best we have for now. It verifies the config tools are working and result in a working authentication as well as agent events are triggered.

It uses three Github secrets as configuration values to provide host, user and password for executing. Your user should use a really good password, since we gonna allow it quite some passwordless sudo requests. The runner is expected to be Debian based, since the scripts rely on apt stuff.

The test suite can't be executed directly on Githubs runners because their kernel doesn't have USB_GADGET support which is required for dummy-hcd/faking removable media. That's why you need to provide your own environment having that kernel option.

The secrets you need to provide, either at personal or organization level (dont use repository, they are contained in forks!), are:

  • TEST_RUNNER_HOST
  • TEST_RUNNER_USER
  • TEST_RUNNER_PASS

Additionally the environment used to run the testsuite should have a nopasswd sudoers config to allow the user used to execute the tests can do the required actions. I'm using this config, saved as /etc/sudoers.d/somefilename:

Note that you need to replace USERNAME and HOSTNAME with the actual values of your environment

Defaults  env_keep += "DEBIAN_FRONTEND"

USERNAME HOSTNAME = (root) NOPASSWD: /usr/bin/apt
USERNAME HOSTNAME = (root) NOPASSWD: /usr/bin/pamusb-conf
USERNAME HOSTNAME = (root) NOPASSWD: /usr/bin/pamusb-check
USERNAME HOSTNAME = (root) NOPASSWD: /usr/sbin/modprobe
USERNAME HOSTNAME = (root) NOPASSWD: /usr/sbin/sfdisk
USERNAME HOSTNAME = (root) NOPASSWD: /usr/bin/mount
USERNAME HOSTNAME = (root) NOPASSWD: /usr/bin/umount
USERNAME HOSTNAME = (root) NOPASSWD: /usr/sbin/mkfs.vfat
USERNAME HOSTNAME = (root) NOPASSWD: /usr/bin/sed
USERNAME HOSTNAME = (root) NOPASSWD: /usr/bin/debconf-set-selections
USERNAME HOSTNAME = (root) NOPASSWD: /usr/sbin/pam-auth-update
USERNAME HOSTNAME = (root) NOPASSWD: /usr/bin/systemctl
USERNAME HOSTNAME = (root) NOPASSWD: /usr/bin/tail

Using the test suite locally

To execute the test suite locally, you need to have a kernel having USB_GADGET and need to execute setup-test-requirements.sh once. That script will install the dummy-hcd module, create the fakestick image etc. After that you can execute the tests by running run-tests.sh. See the scripts, or the action workflow, for details.

Note that you should do that with a dedicated user. Also tests are intended to be run in a clean environment, the Github action is cleaning stuff up for itself but if you run the tests locally you need to do so on your own. You can see the action yml to see the steps required.

Preparing a new release

This is mainly a checklist for myself

Prepare and create new release

  • Create issue & PR to prepare release
  • Check & Update Wiki
  • Check & Update Manpages
  • Update AUTHORS
  • Update CHANGELOG
  • Update Debian changelog
  • Update Fedora changelog
  • Update Arch PKGBUILD versions
  • Update version.h
  • Update version in pamusb-conf
  • Add tag "major.minor.patch" after merging prep PR

Update APT repository

  • make build-debian
  • make deb-sign (APT_SIGNING_KEY is defined in ~/.bashrc)
  • Copy to local repo dir
  • Run update-repo.sh