]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
tests: Don't recreate sockdir after cleanup()
authorDavid Woodhouse <dwmw2@infradead.org>
Tue, 7 Jan 2025 13:06:54 +0000 (13:06 +0000)
committerDavid Woodhouse <dwmw2@infradead.org>
Tue, 7 Jan 2025 13:12:12 +0000 (13:12 +0000)
Ever since commit bba8db3e922d ("modify tests/common.sh so that
launch_simple_sr_server() → test → cleanup() can be used repeatedly in a
single script") the cleanup() function has left an empty socket wrapper
directory behind.

Instead of recreating it in cleanup(), do so in launch_simple_sr_server()
launch_simple_pppd().

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
tests/common.sh

index aecf9e273661c016925c66bcc5641a2e717f618a..7313d3a047f4f96668248a20407eb6e99eca591f 100644 (file)
@@ -67,6 +67,7 @@ update_config() {
 }
 
 launch_simple_sr_server() {
+       mkdir -p $SOCKDIR
        LD_PRELOAD=libsocket_wrapper.so:libuid_wrapper.so UID_WRAPPER=1 UID_WRAPPER_ROOT=1 $OCSERV $* &
 }
 
@@ -104,6 +105,7 @@ launch_simple_pppd() {
        #    the config packets exchanged, causing retries and leading to a longer negotiation period.
        #    [use `socat -x` for a hex log of I/O to/from the connected sockets]
 
+       mkdir -p $SOCKDIR
        LD_PRELOAD=libsocket_wrapper.so socat -t 120 -T 120 -d -d \
                 SYSTEM:"LD_PRELOAD= $SUDO $PPPD noauth local debug nodefaultroute logfile '$LOGFILE' $*",pty,raw,echo=0 \
                 OPENSSL-LISTEN:443,verify=0,cert="$CERT",key="$KEY" 2>&1 &
@@ -123,7 +125,7 @@ cleanup() {
                ret=1
        fi
        wait
-       test -n "$SOCKDIR" && rm -rf $SOCKDIR && mkdir -p $SOCKDIR
+       test -n "$SOCKDIR" && rm -rf $SOCKDIR
        return $ret
 }