testing: migrate build-jobless.sh
Change-Id: Ica9a0c5b8bea50d302ad633d3801431adcdba5e7
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
source common.sh
|
||||
|
||||
drv='
|
||||
builtins.derivation {
|
||||
name = "foo";
|
||||
builder = /bin/sh;
|
||||
system = builtins.currentSystem;
|
||||
requiredSystemFeatures = [ "glitter" ];
|
||||
}
|
||||
'
|
||||
|
||||
# -j0 without remote machines diagnoses build start failure
|
||||
! out="$(nix-build 2>&1 -j0 --expr "$drv" \
|
||||
--builders '' \
|
||||
--system-features 'glitter')"
|
||||
<<<"$out" grepQuiet 'error: unable to start any build; either set '\''--max-jobs'\'' to a non-zero value or enable remote builds.'
|
||||
|
||||
# -j0 with remote machines and missing features also diagnoses
|
||||
! out="$(nix-build 2>&1 -j0 --expr "$drv" \
|
||||
--builders "ssh://localhost?remote-store=$TEST_ROOT/machine1" \
|
||||
--system-features 'glitter')"
|
||||
<<<"$out" grepQuiet 'error: unable to start any build; remote machines may not have all required system features.'
|
||||
@@ -75,7 +75,6 @@ functional_tests_scripts = [
|
||||
'dependencies.sh',
|
||||
'check-reqs.sh',
|
||||
'build-remote-content-addressed-fixed.sh',
|
||||
'build-jobless.sh',
|
||||
'nar-access.sh',
|
||||
'repl.sh',
|
||||
'binary-cache-build-remote.sh',
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import pytest
|
||||
from testlib.fixtures.nix import Nix
|
||||
|
||||
|
||||
drv = """
|
||||
builtins.derivation {
|
||||
name = "foo";
|
||||
builder = /bin/sh;
|
||||
system = builtins.currentSystem;
|
||||
requiredSystemFeatures = [ "glitter" ];
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def set_features(nix: Nix):
|
||||
nix.settings.system_features = "glitter"
|
||||
|
||||
|
||||
def test_j0_without_remotes_fails(nix: Nix):
|
||||
result = nix.nix_build(["-j0", "--expr", drv, "--builders", ""]).run().expect(1)
|
||||
assert (
|
||||
"error: unable to start any build; either set '--max-jobs' to a non-zero value or enable remote builds."
|
||||
in result.stderr_s
|
||||
)
|
||||
|
||||
|
||||
def test_j0_with_mismatched_remotes_fails(nix: Nix):
|
||||
remote = f"ssh://localhost?remote-store={nix.env.dirs.home}/machine1"
|
||||
result = nix.nix_build(["-j0", "--expr", drv, "--builders", remote]).run().expect(1)
|
||||
assert (
|
||||
"error: unable to start any build; remote machines may not have all required system features."
|
||||
in result.stderr_s
|
||||
)
|
||||
Reference in New Issue
Block a user