Commit graph

24 commits

Author SHA1 Message Date
Ed Maste
02376be32d tests/ci: Use :H:H rather than ../..
In general we want to strip subdir components, rather than appending
`..`s.

Reviewed by:	lwhsu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54352
2025-12-26 11:32:27 -05:00
Muhammad Moinur Rahman
4d185f5457
tests/ci: Fix building in Github
When we are using Cirrus-CI and using a PR branch it creates a filename
in the form "pull/XXXX" which becomes a path seperator and the file
creation process fails.

Fails to complete the process with the following:
/bin/sh: cannot create
/tmp/meta.hUNGUq/ci-FreeBSD-16.0-pull/1932-amd64-nullhash-GENERIC.env:
No such file or directory

For future also apply the same regex for OSRELEASE and VOLUME_LABEL.
2025-12-17 23:05:10 +01:00
Muhammad Moinur Rahman
14d5c13a89
tests/ci: Collect environment information
For reproducing errors or test results it is important to gather
environment information. These environments are divided into two parts.
One part is in which environment the artifacts were built into and the
second part is in which environment the tests were run.

This patch collects thesee information and saves into a .env file in
the metadir. After this patch lands we will also need to change our
jenkins job where we are uploading the artifact to a central location.
This environment file should also be stored along with the artifact.
For easier location the image basename and the environment basename are
kept same.

Approved by:	lwhsu
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D54247
2025-12-17 10:20:33 +01:00
Mark Johnston
1d6b6ea2d0 release: Create /firstboot in common VM image creation code
Some services, such as growfs, only run upon the first boot of an image.
The first boot is indicated by the presence of the file /firstboot,
which is unlinked after boot.

Individual cloudware types shouldn't be responsible for creating it.  Do
so in a centralized place.  Aside from simplifying things, this ensures
that we create a metalog entry for the firstboot file.

Reviewed by:	cperciva, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52450
2025-09-11 13:05:31 +00:00
Muhammad Moinur Rahman
932cf5fa44
tests/ci: Add CIENV variable
The default behavior of of pre-commit script is to suppress all the logs
as it is assumed that developers will run this on their terminal for the
tests. But there are also other use cases like running these in
different CI tools like Cirrus, GH Actions etc where these build logs
are important in the web interface itself.

To fix this issue introduce a new variable named CIENV which defaults to
local if empty or undefined. If the CIENV is local in those cases the
logs are suppressed while for anything else it is not. This variable is
also important for some other WIP projects of CI I am working on like
running the CI tests on remote cloud AWS, Azure, GCP etc.

Approved by:	lwhsu
Differential Revision:	https://reviews.freebsd.org/D51178
Event: Oslo hackathon 202508
2025-08-27 12:46:59 +02:00
Siva Mahadevan
178b9c2364
tests/ci: Add missing kmods and pkgs to unskip tests
Signed-off-by: Siva Mahadevan <me@svmhdvn.name>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51309
2025-08-14 05:05:09 +08:00
Siva Mahadevan
ad9b27e097
tests/ci: style: canonicalize, sort, and multiline kmods/pkgs
This helps to remove ambiguity and reduce future diffs of changes
to the VM_EXTRA_PACKAGES list.  Also sort kld_list.

Signed-off-by: Siva Mahadevan <me@svmhdvn.name>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51308
2025-08-14 05:01:26 +08:00
Siva Mahadevan
e990e460d5
tests/ci: Fix unescaped kld_list var in rc.conf
Signed-off-by: Siva Mahadevan <me@svmhdvn.name>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51305
2025-08-14 04:22:04 +08:00
Siva Mahadevan
92a7f2d577
tests/ci: Add KYUA_TEST_FILTERS to allow user to select specific tests
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51306
2025-08-14 04:11:09 +08:00
Siva Mahadevan
9ec37e8ff4
tests/ci: Use QEMU blockdev declaration for all platforms
This patch uses the QEMU manpage-recommended '-blockdev' option instead
of '-drive' to declare block devices. This also makes the mandatory
'-device' declarations constant across all platforms, which fixes the
missing QEMU_DEVICES tarfs device declarations on all Makefile.<arch>
files.

Signed-off-by: Siva Mahadevan <me@svmhdvn.name>
Reviewed by:	imp, lwhsu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51479
2025-07-26 05:52:32 +08:00
Siva Mahadevan
66fe805070
tests/ci: Fix wrong chflags target path in 'beforeclean' target
Signed-off-by: Siva Mahadevan <me@svmhdvn.name>

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51304
2025-07-25 04:12:53 +08:00
Siva Mahadevan
10fb5e7117
tests/ci: Fix race condition with ci-extractmeta
This solves an issue where 'ci-extractmeta' runs in parallel with
'ci-runtest', which would extract an empty test result into the
final test reports output dir. This also cleans up the intermediate
temporary files created along the way.

Signed-off-by: Siva Mahadevan <me@svmhdvn.name>

Reviewed by:	emaste, lwhsu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51363
2025-07-25 04:01:50 +08:00
Muhammad Moinur Rahman
7f849b7f4e
tests/ci: Indent Makefile properly
Approved by:	imp, lwhsu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51445
2025-07-22 12:40:33 +02:00
Muhammad Moinur Rahman
9f3e4b28f9
tests/ci: Fix missing qemu devices
Fix missing QEMU_DEVICES which in turn is the META_TAR device

Approved by:	imp, lwhsu
Sponsored by:	The FreeBSD Foundation
Pull Request:	https://reviews.freebsd.org/D51445
2025-07-22 12:40:32 +02:00
Siva Mahadevan
57f725a6a6
tests/ci: fix missing /usr/local/{sbin,bin} in freebsdci rc PATH
Currently, a lot of tests report 'skipped' due to missing binaries
in the PATH. The real issue is that /etc/rc forcibly restricts the
PATH to the base system only.

This patch re-enables a large chunk of skipped tests by adding
the missing LOCALBASE directories to the PATH so that Kyua can
discover third-party packages. It also fixes some minor rc scripting
style as per the official freebsd scripting guide[0].

[0] https://docs.freebsd.org/en/articles/rc-scripting

Signed-off-by: Siva Mahadevan <me@svmhdvn.name>
Sponsored by: The FreeBSD Foundation
Approved by:	lwhsu
Differential Revision:	https://reviews.freebsd.org/D51303
2025-07-16 22:17:09 +02:00
Siva Mahadevan
2f50ea54c6
tests/ci: fix race condition in bhyveload boot
Currently, there is a race condition where the
Makefile sh invocation of 'bhyveload -c stdio'
exits before receiving any user input in the bootloader
(e.g. in the form of a user typically pressing <enter>),
causing the 'expect' script to wrongly spawn the 'bhyve'
invocation while still in the bootloader.

This patch wraps bhyveload in expect(1) to ensure that
stdio is correctly consumed before the process exits.

Signed-off-by: Siva Mahadevan <me@svmhdvn.name>

Sponsored by:	The FreeBSD Foundation
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1757
2025-07-08 19:32:17 +08:00
Siva Mahadevan
ed4c64bc79
tests/ci: Use suitable variable for qemu-user-static existence check
And simplify a qemu-system existence check.

Signed-off-by: Siva Mahadevan <me@svmhdvn.name>

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1751
2025-07-08 04:25:20 +08:00
Siva Mahadevan
f6e5bcd471
tests/ci: run ci-full kyua tests in parallel
By default, use all available cpus given to the VM. This can be
controlled with the already available PARALLEL_JOBS make variable.

Signed-off-by: Siva Mahadevan <me@svmhdvn.name>

Pull Request:	https://github.com/freebsd/freebsd-src/pull/1754
2025-07-05 00:27:59 +08:00
kalinasp
2c6e4aed07 Fix typos in the CI configuration
Fixes:		a5f03413aa
Fixes:		c08f5ad160
Reviewed by:	asomers, imp, zlei
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1736
2025-06-27 09:19:57 -06:00
Muhammad Moinur Rahman
4b656ded92
Refactor pre-commit CI
Currently our test mechanism is not fit for building without
cross-toolchain as we are not allowing EXTRA_MAKE_FLAGS. Also we are not
allowing to build and test other KERNCONF. So allow these variables to
be overridden in command line.

Approved by:	lwhsu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D50220
2025-05-07 22:25:18 +02:00
Muhammad Moinur Rahman
5ea28c5139
tests/ci: Switch vmm detection
Previously, the CI Makefile used `kldload -n vmm` to determine whether
the host supported bhyve virtualization. However, due to changes in how
QEMU/KVM exposes CPU features to guests, this check no longer reliably
indicates the presence of usable VMX/SVM support.

In particular, modern QEMU configurations expose the vmx CPUID bit by
default, allowing the vmm module to load even when nested virtualization
is disabled.  This causes the old check to incorrectly succeed inside
virtualized environments where bhyve cannot function.

This patch replaces the check with a sysctl-based approach that inspects
kern.vm_guest. If the system identifies itself as running inside a guest
(!= "none"), we assume nested virtualization is unavailable and fallback
to QEMU.

This change ensures CI behaves correctly on platforms where the vmm
module loads but is not usable.

Approved by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D50115
2025-05-02 19:28:51 +02:00
Muhammad Moinur Rahman
c08f5ad160
CI: Add full test support
The patch adds support for running full tests in the local CI
Environment. New features added:

- New target `ci-full` which runs the full test. This is also the
  default now
- Renamed the previous target `ci-smokeit` to `ci-smoke`
- Unlike previous if the available memory is more than 16G a default of
  8G will be used
- Removed some unnecessary debug messages
- Added `dummybuf` kernel module to the list of modules to be loaded on
  the VM

The features that can be tested:
`make TARGET=<TARGET> TARGET_ARCH=<TARGET_ARCH> CITYPE=full ci`
`make TARGET=<TARGET> TARGET_ARCH=<TARGET_ARCH> ci` is also the same as
above as CITYPE full is the default now

Approved by:	lwhsu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D48015
2025-04-30 10:18:08 +02:00
Warner Losh
a5f03413aa ci: Redirect output for builds.
This target is far too noisy to be at all useful. Save the output ala
make universe in _. files. Also report where to find errors.

Sponsored by:		Netflix
2024-05-23 11:59:40 -06:00
Muhammad Moinur Rahman
cb9d4bb1fb
Add preliminary in-tree CI infrastructure for developers
The goal of this project is to integrate the relevant scripts from the
FreeBSD-CI project (https://github.com/freebsd/freebsd-ci) into the src
repository. This allows developers to run the test suite similar to how
it is executed on ci.freebsd.org, and eventually, have it directly used
by our CI system. This effort is also part of the workflow improvement
project, aiming to incorporate pre-merge testing.

Current Features:
* Does smoke tests using either bhyve(amd64 only) or qemu(Non x86_64 or
  when defined USE_QEMU=1). Currently defined CITYPE=smoke. Once we have
  added full tests we can also utilize something like CITYPE=full
* Most of the resources are dynamically allocated based on available
  resources in the host
* If CPU supports POPCNT or vmm can be loaded then bhyve is used for
  amd64 otherwise automatically installs and uses qemu@nox11
* When required third party applications or packages for booting non-x86
  images are automatically installed

Current Limitation:
* Does not support full tests like the one in our Jenkins
* At this moment this is also not suitable to be used in our Jenkins
  platform as the jobs are divided in multiple smaller tasks and
  artifacts are moved here and there which are not exactly the scenario
  for individual developers.

Future Works:
* Add full tests like the one in ci.freebsd.org
* Add different tests or options to disable some tests
* Add test profiles full
* Possibly add test through Cloud Providers like AWS/GCP/Azure or Cirrus
  or Github Actions
* Update documentation

Test Plan:
cd /usr/src/tests/ci
make ci
make TARGET=amd64 TARGET_ARCH=amd64 ci
make TARGET=amd64 TARGET_ARCH=amd64 USE_QEMU=1 ci
make TARGET=arm64 TARGET_ARCH=aarch64 ci
make TARGET=powerpc TARGET_ARCH=powerpc64 ci
make TARGET=powerpc TARGET_ARCH=powerpc64le ci
make TARGET=riscv TARGET_ARCH=riscv64 ci

Reviewed by:           lwhsu
Sponsored by:          The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43786
2024-04-18 20:02:24 +02:00