tests: use a nested attrset for buildbot

We need to optimise the buildbot attrs for nix-eval-jobs, however this
doesn't make sense for `nix flake check` or `nix flake show`.

Now that we aren't using the `checks` output, we don't _need_ to
restrict ourselves to a flat set of test derivations anymore.

This also simplifies our `tests` command, and means we no longer need to
pre-compute the test attr names.
This commit is contained in:
Matt Sturgeon 2025-07-01 01:51:58 +01:00
parent 1463ec64d5
commit db7c5364a5
3 changed files with 12 additions and 38 deletions

View file

@ -40,7 +40,10 @@ group_size=20
print_attrpath=false
mk_test_list() {
jq -r 'keys[]' "${NIXVIM_TESTS}"
nix eval ".#checks.$system.tests.entries" \
--apply builtins.attrNames \
--json |
jq -r '.[]'
}
while true; do
@ -83,23 +86,6 @@ while true; do
esac
done
get_tests() {
# Convert bash array to jq query
# e.g. (foo bar baz) => ."foo",."bar",."baz"
readarray -t queries < <(
for test in "$@"; do
echo '."'"$test"'"'
done
)
query=$(
IFS=,
echo "${queries[*]}"
)
for test in $(jq -r "${query}" "${NIXVIM_TESTS}"); do
echo "checks.${system}.${test}"
done
}
build_group() {
if ! "${NIXVIM_NIX_COMMAND}" build "${nix_args[@]}" --no-link --file . "$@"; then
echo "Test failure" >&2
@ -145,7 +131,11 @@ build_in_groups() {
}
run_tests() {
readarray -t test_list < <(get_tests "$@")
readarray -t test_list < <(
for test in "$@"; do
echo "checks.${system}.tests.entries.${test}"
done
)
if [[ $print_attrpath == true ]]; then
echo
echo "Full attr paths:"