fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ lib
2, writeText
3, runCommand
4, tsm-client
5}:
6
7# Let the client try to connect to a server.
8# We can't simulate a server, so there's no more to test.
9
10let
11
12 # 192.0.0.8 is a "dummy address" according to RFC 7600
13 dsmSysCli = writeText "cli.dsm.sys" ''
14 defaultserver testserver
15 server testserver
16 commmethod v6tcpip
17 tcpserveraddress 192.0.0.8
18 nodename ARBITRARYNODENAME
19 '';
20
21 tsm-client_ = tsm-client.override { inherit dsmSysCli; };
22
23 env.nativeBuildInputs = [ tsm-client_ ];
24
25 versionString =
26 let
27 inherit (tsm-client_.passthru.unwrapped) version;
28 major = lib.versions.major version;
29 minor = lib.versions.minor version;
30 patch = lib.versions.patch version;
31 fixup = lib.lists.elemAt (lib.versions.splitVersion version) 3;
32 in
33 "Client Version ${major}, Release ${minor}, Level ${patch}.${fixup}";
34
35in
36
37runCommand "${tsm-client.name}-test-cli" env ''
38 set -o nounset
39 set -o pipefail
40
41 export DSM_LOG=$(mktemp -d ./dsm_log.XXXXXXXXXXX)
42
43 { dsmc -optfile=/dev/null || true; } | tee dsmc-stdout
44
45 # does it report the correct version?
46 grep --fixed-strings '${versionString}' dsmc-stdout
47
48 # does it use the provided dsm.sys config file?
49 # if it does, it states the node's name
50 grep ARBITRARYNODENAME dsmc-stdout
51
52 # does it try (and fail) to connect to the server?
53 # if it does, it reports the "TCP/IP connection failure" error code
54 grep ANS1017E dsmc-stdout
55 grep ANS1017E $DSM_LOG/dsmerror.log
56
57 touch $out
58''