Changes to packaging.
This commit is contained in:
1 parent
758b038e1a
commit
440400985b
8 files changed
+198
-22
No files matched your search
@@ -25,6 +25,57 @@ target.chmod(0o755)
|
||||
|
||||
|
||||
class PackageBinaryTests(unittest.TestCase):
|
||||
def test_checks_use_private_session_and_preserve_failure_status(self):
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
recipes = sorted((root / "distro-packages").rglob("PKGBUILD"))
|
||||
for recipe in recipes:
|
||||
for exit_code in (0, 7):
|
||||
with self.subTest(recipe=recipe.parent.name, exit_code=exit_code), \
|
||||
tempfile.TemporaryDirectory() as tmp:
|
||||
work = Path(tmp)
|
||||
(work / "cthulhu").mkdir()
|
||||
desktop_runtime = work / "desktop-runtime"
|
||||
desktop_runtime.mkdir()
|
||||
canary = desktop_runtime / "canary"
|
||||
canary.write_text("preserve\n")
|
||||
runtime_record = work / "test-runtime"
|
||||
tools = work / "tools"
|
||||
tools.mkdir()
|
||||
go = tools / "go"
|
||||
go.write_text('''#!/usr/bin/env python3
|
||||
import os
|
||||
from pathlib import Path
|
||||
import stat
|
||||
import sys
|
||||
assert sys.argv[1:] == ["test", "-tags", "brlapi", "./...", "-count=1"]
|
||||
assert os.environ["GOWORK"] == "off"
|
||||
for name in ("DISPLAY", "WAYLAND_DISPLAY", "AT_SPI_BUS_ADDRESS",
|
||||
"DBUS_STARTER_ADDRESS", "DBUS_STARTER_BUS_TYPE"):
|
||||
assert name not in os.environ, name
|
||||
assert os.environ["DBUS_SESSION_BUS_ADDRESS"] != "unix:path=/nonexistent-desktop-bus"
|
||||
runtime = Path(os.environ["XDG_RUNTIME_DIR"])
|
||||
assert runtime != Path(os.environ["DESKTOP_RUNTIME"])
|
||||
assert stat.S_IMODE(runtime.stat().st_mode) == 0o700
|
||||
Path(os.environ["RUNTIME_RECORD"]).write_text(str(runtime))
|
||||
sys.exit(int(os.environ["CHECK_EXIT_CODE"]))
|
||||
''')
|
||||
go.chmod(0o755)
|
||||
environment = dict(
|
||||
os.environ, PATH=f"{tools}:{os.environ['PATH']}", srcdir=str(work),
|
||||
XDG_RUNTIME_DIR=str(desktop_runtime), DESKTOP_RUNTIME=str(desktop_runtime),
|
||||
DISPLAY=":9999", WAYLAND_DISPLAY="wayland-fixture",
|
||||
AT_SPI_BUS_ADDRESS="unix:path=/nonexistent-atspi-bus",
|
||||
DBUS_SESSION_BUS_ADDRESS="unix:path=/nonexistent-desktop-bus",
|
||||
DBUS_STARTER_ADDRESS="unix:path=/nonexistent-starter-bus",
|
||||
DBUS_STARTER_BUS_TYPE="session", GOWORK="/nonexistent/go.work",
|
||||
RUNTIME_RECORD=str(runtime_record), CHECK_EXIT_CODE=str(exit_code))
|
||||
result = subprocess.run(
|
||||
["bash", "-ec", 'source "$1"\ncheck', "package-test", str(recipe)],
|
||||
cwd=work, env=environment, capture_output=True, text=True, check=False)
|
||||
self.assertEqual(result.returncode, exit_code, result.stderr)
|
||||
self.assertFalse(Path(runtime_record.read_text()).exists())
|
||||
self.assertEqual(canary.read_text(), "preserve\n")
|
||||
|
||||
def test_build_and_install_source_supported_helpers(self):
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
recipes = sorted((root / "distro-packages").rglob("PKGBUILD"))
|
||||
|
||||
Reference in new issue
Block a user