Skip to content

Commit

Permalink
WIP epics-base: pass tests
Browse files Browse the repository at this point in the history
  • Loading branch information
minijackson committed Aug 11, 2023
1 parent b7d5853 commit 90eb796
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions pkgs/epnix/epics-base/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
buildPackages,
mkEpicsPackage,
fetchgit,
fetchpatch,
version,
hash,
readline,
local_config_site ? {},
local_release ? {},
iproute2,
util-linux,
}:
with lib; let
older = versionOlder version;
Expand All @@ -37,6 +37,9 @@ in
inherit hash;
};

# In order to add the dummy network interface, and for the 'unshare' command
nativeBuildInputs = [iproute2 util-linux];

patches = optionals (older "7.0.5") [
# Support "undefine MYVAR" in convertRelease.pl
# Fixed by commit 79d7ac931502e1c25b247a43b7c4454353ac13a6
Expand Down Expand Up @@ -133,8 +136,37 @@ in
$out/lib/perl/*/${stdenv.buildPlatform.system}*
'');

# Use unshare to place ourselves in a different network namespace,
# allowing us to create and manipulate network interfaces.
checkPhase = ''
unshare --map-root-user --net $SHELL <<<"$containedCheckPhase"
'';

containedCheckPhase = ''
# Setup the loopback address that disappeared
# when we entered the net namespace
ip addr add 127.0.0.1/8 scope host dev lo
ip addr add ::1/128 scope host dev lo
# Add a dummy interface with a broadcast address
ip link add epics1 type dummy
ip addr add 192.168.100.1/24 broadcast + dev epics1
local flagsArray=(
-j''${NIX_BUILD_CORES}
SHELL=$SHELL
VERBOSE=y
runtests
)
echoCmd 'check flags' "''${flagsArray[@]}"
make "''${flagsArray[@]}"
unset flagsArray
'';

# TODO: Some tests fail
doCheck = false;
doCheck = true;

meta = {
description = "The Experimental Physics and Industrial Control System";
Expand Down

0 comments on commit 90eb796

Please sign in to comment.