From 91365cd23abc28395b78b53d67b280f5b159a906 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Tue, 15 May 2018 14:10:29 +0200 Subject: nexus: fix setup and nixos test (#40522) The original `nexus` derivation required `/run/sonatype-work/nexus3` which explicitly depended on the NixOS path structure. This would break `nexus` for everyone using `nixpkgs` on a non-NixOS system, additionally the module never created `/run/sonatype-work`, so the systemd unit created in `services.nexus` fails as well. The issue wasn't actively known as the `nixos/nexus` test wasn't registered in Hydra (see #40257). This patch contains the following changes: * Adds `tests.nexus` to `release.nix` to run the test on Hydra. * Makes JVM parameters configurable: by default all JVM options were located in `result/bin/nexus.vmoptions` which made it quite hard to patch these parameters. Now it's possible to override all parameters by running `VM_OPTS_FILE=custom-nexus.vmoptions ./result/bin/nexus run` (after patching the `nexus` shell script), additionally it's possible to override these parameters with `services.nexus.vmoptions`. * Bumped Nexus from 3.5.1 to 3.11.0 * Run the `nexus` test on Hydra with `callTest` in `nixos/release.nix`, furthermore the test checks if the UI is available on the specified port. * Added myself as maintainer for the NixOS test and the package to have some more people in case of further breakage. * Added sufficient disk space to the `nexus` test, otherwise the service fails with the following errors: ``` com.orientechnologies.orient.core.exception.ODatabaseException: Cannot create database 'accesslog' com.orientechnologies.orient.core.exception.OLowDiskSpaceException: Error occurred while executing a write operation to database 'accesslog' due to limited free space on the disk (242 MB). The database is now working in read-only mode. Please close the database (or stop OrientDB), make room on your hard drive and then reopen the database. The minimal required space is 256 MB. Required space is now set to 256MB (you can change it by setting parameter storage.diskCache.diskFreeSpaceLimit) . ``` /cc @ironpinguin @xeji --- nixos/release.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'nixos/release.nix') diff --git a/nixos/release.nix b/nixos/release.nix index 7ec41af4fd4bb..365f93b731e1e 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -346,6 +346,7 @@ in rec { tests.networking.scripted = callSubTests tests/networking.nix { networkd = false; }; # TODO: put in networking.nix after the test becomes more complete tests.networkingProxy = callTest tests/networking-proxy.nix {}; + tests.nexus = callTest tests/nexus.nix { }; tests.nfs3 = callTest tests/nfs.nix { version = 3; }; tests.nfs4 = callTest tests/nfs.nix { version = 4; }; tests.nginx = callTest tests/nginx.nix { }; -- cgit 1.4.1 From 1c043637140514df1205830e2ac860e57ef7a23a Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 13 Feb 2018 17:52:49 +0100 Subject: nixos/flatpak: add test --- nixos/release.nix | 1 + nixos/tests/flatpak.nix | 23 ++++++ .../libraries/flatpak/fix-test-paths.patch | 86 ++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 nixos/tests/flatpak.nix (limited to 'nixos/release.nix') diff --git a/nixos/release.nix b/nixos/release.nix index ae70b535a5e2f..8151d1bac5ed8 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -284,6 +284,7 @@ in rec { tests.env = callTest tests/env.nix {}; tests.ferm = callTest tests/ferm.nix {}; tests.firefox = callTest tests/firefox.nix {}; + tests.flatpak = callTest tests/flatpak.nix {}; tests.firewall = callTest tests/firewall.nix {}; tests.fwupd = callTest tests/fwupd.nix {}; #tests.gitlab = callTest tests/gitlab.nix {}; diff --git a/nixos/tests/flatpak.nix b/nixos/tests/flatpak.nix new file mode 100644 index 0000000000000..d1c7cf843147e --- /dev/null +++ b/nixos/tests/flatpak.nix @@ -0,0 +1,23 @@ +# run installed tests +import ./make-test.nix ({ pkgs, ... }: + +{ + name = "flatpak"; + meta = { + maintainers = pkgs.flatpak.meta.maintainers; + }; + + machine = { config, pkgs, ... }: { + imports = [ ./common/x11.nix ]; + services.xserver.desktopManager.gnome3.enable = true; # TODO: figure out minimal environment where the tests work + services.flatpak.enable = true; + environment.systemPackages = with pkgs; [ gnupg gnome-desktop-testing ostree python2 ]; + virtualisation.memorySize = 2047; + virtualisation.diskSize = 1024; + }; + + testScript = '' + $machine->waitForX(); + $machine->succeed("gnome-desktop-testing-runner -d '${pkgs.flatpak.installedTests}/share' --timeout 3600"); + ''; +}) diff --git a/pkgs/development/libraries/flatpak/fix-test-paths.patch b/pkgs/development/libraries/flatpak/fix-test-paths.patch index e0734009420c2..a548f3882864e 100644 --- a/pkgs/development/libraries/flatpak/fix-test-paths.patch +++ b/pkgs/development/libraries/flatpak/fix-test-paths.patch @@ -33,6 +33,81 @@ gpg-connect-agent --homedir "${FL_GPG_HOMEDIR}" killagent /bye || true fusermount -u $XDG_RUNTIME_DIR/doc || : if test -n "${TEST_SKIP_CLEANUP:-}"; then +--- a/tests/make-test-runtime.sh ++++ b/tests/make-test-runtime.sh +@@ -21,6 +21,7 @@ + cat ${DIR}/metadata + + # Add bash and dependencies ++mkdir -p ${DIR}/nix/store + mkdir -p ${DIR}/usr/bin + mkdir -p ${DIR}/usr/lib + ln -s ../lib ${DIR}/usr/lib64 +@@ -30,47 +31,27 @@ + else + cp `which ldconfig` ${DIR}/usr/bin + fi +-T=`mktemp` +-for i in $@; do +- I=`which $i` +- cp $I ${DIR}/usr/bin +- ldd $I | sed "s/.* => //" | awk '{ print $1}' | grep ^/ | grep ^/ >> $T +- if test $i == python2; then +- mkdir -p ${DIR}/usr/lib/python2.7/lib-dynload +- # This is a hardcoded minimal set of modules we need in the current tests. +- # Pretty hacky stuff. Add modules as needed. +- PYDIR=/usr/lib/python2.7 +- if test -d /usr/lib64/python2.7; then PYDIR=/usr/lib64/python2.7; fi +- for py in site os stat posixpath genericpath warnings \ +- linecache types UserDict abc _abcoll \ +- _weakrefset copy_reg traceback sysconfig \ +- re sre_compile sre_parse sre_constants \ +- _sysconfigdata ; do +- cp ${PYDIR}/$py.py ${DIR}/usr/lib/python2.7 +- done +- # These might not exist, depending how Python was configured; and the +- # part after ${so} might be "module" or ".x86_64-linux-gnu" or +- # something else +- for so in _locale strop ; do +- cp ${PYDIR}/lib-dynload/${so}*.so ${DIR}/usr/lib/python2.7/lib-dynload || : +- done +- for plat in $( cd ${PYDIR} && echo plat-* ); do +- test -e ${PYDIR}/${plat} || continue +- mkdir -p ${DIR}/usr/lib/python2.7/${plat} +- cp ${PYDIR}/${plat}/*.py ${DIR}/usr/lib/python2.7/${plat}/ +- done +- fi +-done + ln -s bash ${DIR}/usr/bin/sh +-for i in `sort -u $T`; do +- cp "$i" ${DIR}/usr/lib/ ++for i in $@; do ++ I=$(readlink -f $(which $i)) ++ requisites=$(nix-store --query --requisites "$I") ++ for r in $requisites; do ++ # a single store item can be needed by multiple paths, no need to copy it again ++ if [ ! -e ${DIR}/$r ]; then ++ cp -r $r ${DIR}/$r ++ fi ++ done ++ ln -s $I ${DIR}/usr/bin/$i + done + +-# We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but +-# the real en_US locale is often not available, because its in the +-# local archive. ++mv ${DIR}/nix/store ${DIR}/usr/store # files outside /usr are not permitted, we will have to replace /nix/store with /usr/store ++chmod -R u+w ${DIR} # nix store has read-only directories which would cause problems during clean-up, files need to be writable for sed ++find ${DIR} -type f -print0 | xargs -0 sed -i 's~/nix/store/~/usr/store/~g' # replace hardcoded paths ++find ${DIR} -type l | xargs -I '{}' sh -c 'tg="$(readlink "$1")"; newtg="${tg#/nix/store/}"; if [ "$tg" != "$newtg" ]; then ln -fs "/usr/store/$newtg" "$1"; fi' -- '{}' # replace symlink targets ++ ++# We copy the whole locale archive because we do not have C.UTF8 locale + mkdir -p ${DIR}/usr/lib/locale/ +-cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US ++cp @glibcLocales@/lib/locale/locale-archive ${DIR}/usr/lib/locale/locale-archive + + if [ x$COLLECTION_ID != x ]; then + collection_args=--collection-id=${COLLECTION_ID} --- a/tests/testlibrary.c +++ b/tests/testlibrary.c @@ -378,7 +378,7 @@ @@ -44,3 +119,14 @@ g_autofree char *argv_str = g_strjoinv (" ", argv); g_test_message ("Spawning %s", argv_str); g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, &exit_code, &error); +--- a/triggers/gtk-icon-cache.trigger ++++ b/triggers/gtk-icon-cache.trigger +@@ -1,7 +1,7 @@ + #!/bin/sh + + if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d $1/exports/share/icons/hicolor \); then +- cp /usr/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/ ++ cp @hicolorIconTheme@/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/ + for dir in $1/exports/share/icons/*; do + if test -f $dir/index.theme; then + if ! gtk-update-icon-cache --quiet $dir; then -- cgit 1.4.1 From 21ff482f7d7fa233ebdf553ddc5edf459e7344eb Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 22 Feb 2018 06:29:51 +0100 Subject: nixos/xdg-desktop-portal: add test --- nixos/release.nix | 1 + nixos/tests/xdg-desktop-portal.nix | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 nixos/tests/xdg-desktop-portal.nix (limited to 'nixos/release.nix') diff --git a/nixos/release.nix b/nixos/release.nix index 8151d1bac5ed8..f8f643f1a5aba 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -399,6 +399,7 @@ in rec { tests.virtualbox = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/virtualbox.nix {}; tests.wordpress = callTest tests/wordpress.nix {}; tests.xautolock = callTest tests/xautolock.nix {}; + tests.xdg-desktop-portal = callTest tests/xdg-desktop-portal.nix {}; tests.xfce = callTest tests/xfce.nix {}; tests.xmonad = callTest tests/xmonad.nix {}; tests.xrdp = callTest tests/xrdp.nix {}; diff --git a/nixos/tests/xdg-desktop-portal.nix b/nixos/tests/xdg-desktop-portal.nix new file mode 100644 index 0000000000000..d954b07f73d6f --- /dev/null +++ b/nixos/tests/xdg-desktop-portal.nix @@ -0,0 +1,17 @@ +# run installed tests +import ./make-test.nix ({ pkgs, ... }: + +{ + name = "xdg-desktop-portal"; + meta = { + maintainers = pkgs.xdg-desktop-portal.meta.maintainers; + }; + + machine = { config, pkgs, ... }: { + environment.systemPackages = with pkgs; [ gnome-desktop-testing ]; + }; + + testScript = '' + $machine->succeed("gnome-desktop-testing-runner -d '${pkgs.xdg-desktop-portal.installedTests}/share'"); + ''; +}) -- cgit 1.4.1