diff options
Diffstat (limited to 'lib/libktest.sh')
-rw-r--r-- | lib/libktest.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libktest.sh b/lib/libktest.sh index 0e5aae7..99bccc1 100644 --- a/lib/libktest.sh +++ b/lib/libktest.sh @@ -266,6 +266,14 @@ save_env() rm -rf "$ktest_out/vm/env_tmp" } +get_unused_port() +{ + comm -23 --nocheck-order \ + <(seq 10000 65535) \ + <(ss -tan | awk '{print $4}' | cut -d':' -f2 | grep '[0-9]\{1,5\}' | sort -n | uniq) \ + | shuf | head -n1 +} + start_vm() { make -C "$ktest_dir/lib" qemu-wrapper |