Mrtest

From postmarketOS
mrtest add in action, about to upgrade the kernel to a version from a merge request

mrtest helps with testing merge requests from both pmaports, as well as Alpine's aports. It automatizes downloading the packages that were built in CI and offers a convenient, interactive prompt to install them.

It's meant to be run on your postmarketOS device (ie. your phone).

Installation on PostmarketOS

Either from Alpine's packages

# apk add mrtest

Or from the git repository

$ git clone https://gitlab.com/postmarketOS/mrhlpr.git

mrtest source code lives inside mrhlpr.git, as it shares code for interacting with the gitlab API with the mrhlpr project.

Installing packages

Navigate to a merge request that you want to test. After reading through the changes made in the merge request, run mrtest add with the ID. It will automatically figure out the last pipeline, get the job with the suitable arch of your device, and show which packages are available for installation. Then you will be able to select the packages in an interactive prompt.

To install packages from a merge request in Alpine, use mrtest add -a (or --alpine).

Example

Trying to test pmaports!3025 results in the following output:

$ mrtest add 3025
Download https://gitlab.com/api/v4/projects/postmarketOS%2Fpmaports/merge_requests/3025
Download https://gitlab.com/api/v4/projects/8065375
Download https://gitlab.com/api/v4/projects/8065375/pipelines/502182185/jobs
Download https://gitlab.com/api/v4/projects/8065375/jobs/2255535921/artifacts
Getting installed packages...
Which packages to install?

  1) [ ] powersupply-0.6.0-r0.apk

0 of 1 selected.

Commands:
  1-99: toggle this package
  a:    toggle all packages
  u:    toggle upgrade (or downgrade) of installed packages
  l:    list selection
  y:    confirm selection
  q:    quit

What now?> a
1 of 1 selected.
What now?> y
Selection confirmed
Extracting packages from artifacts archive...
Installing packages...
(1/7) Installing py3-ordered-set (4.0.2-r3)
(2/7) Installing py3-appdirs (1.4.4-r3)
(3/7) Installing py3-parsing (2.4.7-r3)
(4/7) Installing py3-packaging (21.3-r0)
(5/7) Installing py3-setuptools (52.0.0-r5)
(6/7) Installing powersupply (0.6.0-r0)
(7/7) Installing .mrtest-3025-postmarketOS (20220327.153518)
Executing busybox-1.35.0-r6.trigger
Executing gtk-update-icon-cache-2.24.33-r0.trigger
OK: 1985 MiB in 919 packages
All done! Use 'mrtest zap' to uninstall added packages.

Uninstalling packages

Use mrtest zap to check for previously installed virtual packages, and to get a prompt to uninstall them. Uninstalling virtual packages will remove all packages that were added with a mrtest add command. Note that this does not include upgraded packages, to remove upgrade packages you will need to run apk upgrade -a as the output at the end of mrtest zap explains.

Example

$ mrtest zap              
Getting installed packages...
Virtual packages from previous 'mrtest add':
* .mrtest-3025-postmarketOS
Remove virtual packages and packages added with mrtest? [y/N] y
Removing packages...
(1/7) Purging .mrtest-3025-postmarketOS (20220327.153518)
(2/7) Purging powersupply (0.6.0-r0)
(3/7) Purging py3-setuptools (52.0.0-r5)
(4/7) Purging py3-ordered-set (4.0.2-r3)
(5/7) Purging py3-appdirs (1.4.4-r3)
(6/7) Purging py3-packaging (21.3-r0)
(7/7) Purging py3-parsing (2.4.7-r3)
Executing busybox-1.35.0-r6.trigger
Executing gtk-update-icon-cache-2.24.33-r0.trigger
OK: 1981 MiB in 912 packages
All done!

Note that 'mrtest zap' will only remove packages *added* during
'mrtest add'. If you want to revert package *upgrades*, run
'apk upgrade -a'. This will upgrade/downgrade all your packages
to the versions in the repositories.

Note that packages installed through mrtest add won't be automatically upgraded. You'll need to mrtest zap them before you'd be able to install newer versions from the official binary repo later using apk upgrade.

See also