summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-09-10 21:47:32 +0000
committerLaurent Bercot <ska@appnovation.com>2021-09-10 21:47:32 +0000
commitdf065a2ef3e40f7c002e286b2a45811a7227776a (patch)
tree48ac0bab114bb44cdabbd6af9106ea036d4436ed /src/tests
parent6fdb4834cdb5557d9bd7562f61984da8bd0d9c80 (diff)
downloadnsss-df065a2ef3e40f7c002e286b2a45811a7227776a.tar.xz
Implement a real nsssd-switch, with a test
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/tests')
l---------src/tests/deps-exe/test-nsssd-switch1
l---------src/tests/test-nsssd-switch.baseline1
l---------src/tests/test-nsssd-switch.c1
-rwxr-xr-xsrc/tests/test-nsssd-switch.wrapper21
4 files changed, 24 insertions, 0 deletions
diff --git a/src/tests/deps-exe/test-nsssd-switch b/src/tests/deps-exe/test-nsssd-switch
new file mode 120000
index 0000000..9cb6054
--- /dev/null
+++ b/src/tests/deps-exe/test-nsssd-switch
@@ -0,0 +1 @@
+test-switch \ No newline at end of file
diff --git a/src/tests/test-nsssd-switch.baseline b/src/tests/test-nsssd-switch.baseline
new file mode 120000
index 0000000..28f1c7a
--- /dev/null
+++ b/src/tests/test-nsssd-switch.baseline
@@ -0,0 +1 @@
+test-switch.baseline \ No newline at end of file
diff --git a/src/tests/test-nsssd-switch.c b/src/tests/test-nsssd-switch.c
new file mode 120000
index 0000000..08323c4
--- /dev/null
+++ b/src/tests/test-nsssd-switch.c
@@ -0,0 +1 @@
+test-switch.c \ No newline at end of file
diff --git a/src/tests/test-nsssd-switch.wrapper b/src/tests/test-nsssd-switch.wrapper
new file mode 100755
index 0000000..8e05937
--- /dev/null
+++ b/src/tests/test-nsssd-switch.wrapper
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+S=./.test-switch-socket
+F=./.test-switch-fifo
+
+pid=0
+
+cleanup () {
+ kill $pid
+ rm -f $S
+}
+
+mkfifo $F
+head -n 1 < $F >/dev/null &
+pid=$!
+s6-ipcserver -1 -- $S ./nsssd-switch 0 ' ./nsssd-unix' '' > $F &
+wait $pid
+pid=$!
+rm -f $F
+trap cleanup TERM INT EXIT
+./test-nsssd-switch