diff --git a/python3.10-http-server/scripts/README.md b/python3.10-http-server/scripts/README.md new file mode 100644 index 00000000..e1cabee7 --- /dev/null +++ b/python3.10-http-server/scripts/README.md @@ -0,0 +1,56 @@ +# Scripts for Python3.10-http-server on Unikraft + +These are companions instruction to the main instructions in the [`README`](README.md). + +Use scripts as quick actions for building and running Python3.10-http-server on Unikraft. + +**Note**: Run scripts from the application directory. + +## Build for / : + +```console +./scripts/build/. +``` + +e.g.: + +```console +./scripts/build/qemu.x86_64 +./scripts/build/qemu.arm64 +./scripts/build/fc.x86_64 +./scripts/build/xen.arm64 +``` + +## Build for / using a different compiler + +```console +CC=/path/to/compiler ./scripts/build/. +``` + +e.g. + +```console +CC=/usr/bin/gcc-12 ./scripts/build/qemu.x86_64 +CC=/usr/bin/aarch64-linux-gnu-gcc-12 ./scripts/build/qemu.arm64 +CC=/usr/bin/clang ./scripts/build/qemu.x86_64 +CC=/usr/bin/clang ./scripts/build/qemu.arm64 +CC=/usr/bin/gcc-12 ./scripts/build/fc.x86_64 +CC=/usr/bin/aarch64-linux-gnu-gcc-12 ./scripts/build/fc.arm64 +CC=/usr/bin/clang ./scripts/build/fc.x86_64 +CC=/usr/bin/clang ./scripts/build/fc.arm64 +``` + +## Run on / + +```console +./scripts/run/. +``` + +e.g. + +```console +./scripts/run/qemu.x86_64 +./scripts/run/qemu.arm64 +./scripts/run/fc.x86_64 +./scripts/run/xen.arm64 +``` \ No newline at end of file diff --git a/python3.10-http-server/scripts/build/fc.arm64 b/python3.10-http-server/scripts/build/fc.arm64 new file mode 100755 index 00000000..ec1d6f16 --- /dev/null +++ b/python3.10-http-server/scripts/build/fc.arm64 @@ -0,0 +1,11 @@ +#!/bin/sh + +make distclean +UK_DEFCONFIG=$(pwd)/scripts/defconfig/fc.arm64 make defconfig +touch Makefile.uk +make prepare +if test -z "$CC"; then + make -j $(nproc) +else + make CC="$CC" -j $(nproc) +fi diff --git a/python3.10-http-server/scripts/build/fc.x86_64 b/python3.10-http-server/scripts/build/fc.x86_64 new file mode 100755 index 00000000..52a81172 --- /dev/null +++ b/python3.10-http-server/scripts/build/fc.x86_64 @@ -0,0 +1,11 @@ +#!/bin/sh + +make distclean +UK_DEFCONFIG=$(pwd)/scripts/defconfig/fc.x86_64 make defconfig +touch Makefile.uk +make prepare +if test -z "$CC"; then + make -j $(nproc) +else + make CC="$CC" -j $(nproc) +fi diff --git a/python3.10-http-server/scripts/build/qemu.arm64 b/python3.10-http-server/scripts/build/qemu.arm64 new file mode 100755 index 00000000..10e669d0 --- /dev/null +++ b/python3.10-http-server/scripts/build/qemu.arm64 @@ -0,0 +1,11 @@ +#!/bin/sh + +make distclean +UK_DEFCONFIG=$(pwd)/scripts/defconfig/qemu.arm64 make defconfig +touch Makefile.uk +make prepare +if test -z "$CC"; then + make -j $(nproc) +else + make CC="$CC" -j $(nproc) +fi diff --git a/python3.10-http-server/scripts/build/qemu.x86_64 b/python3.10-http-server/scripts/build/qemu.x86_64 new file mode 100755 index 00000000..785447a1 --- /dev/null +++ b/python3.10-http-server/scripts/build/qemu.x86_64 @@ -0,0 +1,11 @@ +#!/bin/sh + +make distclean +UK_DEFCONFIG=$(pwd)/scripts/defconfig/qemu.x86_64 make defconfig +touch Makefile.uk +make prepare +if test -z "$CC"; then + make -j $(nproc) +else + make CC="$CC" -j $(nproc) +fi diff --git a/python3.10-http-server/scripts/build/xen.arm64 b/python3.10-http-server/scripts/build/xen.arm64 new file mode 100755 index 00000000..76a625af --- /dev/null +++ b/python3.10-http-server/scripts/build/xen.arm64 @@ -0,0 +1,11 @@ +#!/bin/sh + +make distclean +UK_DEFCONFIG=$(pwd)/scripts/defconfig/xen.arm64 make defconfig +touch Makefile.uk +make prepare +if test -z "$CC"; then + make -j $(nproc) +else + make CC="$CC" -j $(nproc) +fi diff --git a/python3.10-http-server/scripts/build/xen.x86_64 b/python3.10-http-server/scripts/build/xen.x86_64 new file mode 100755 index 00000000..98b50624 --- /dev/null +++ b/python3.10-http-server/scripts/build/xen.x86_64 @@ -0,0 +1,11 @@ +#!/bin/sh + +make distclean +UK_DEFCONFIG=$(pwd)/scripts/defconfig/xen.x86_64 make defconfig +touch Makefile.uk +make prepare +if test -z "$CC"; then + make -j $(nproc) +else + make CC="$CC" -j $(nproc) +fi diff --git a/python3.10-http-server/scripts/defconfig/fc.arm64 b/python3.10-http-server/scripts/defconfig/fc.arm64 new file mode 100644 index 00000000..fdcb1ec1 --- /dev/null +++ b/python3.10-http-server/scripts/defconfig/fc.arm64 @@ -0,0 +1,13 @@ +CONFIG_ARCH_ARM64=y +CONFIG_PLAT_FC=y +CONFIG_APPPYHTON3_HTTP_SERVER=y +CONFIG_LIBPYTHON3=y +CONFIG_LIBPYTHON3_MAIN_FUNCTION=y +CONFIG_LIBPOSIX_VFS_FSTAB=y +CONFIG_LIBPOSIX_VFS_FSTAB_BUILTIN_RAMFS=y +CONFIG_LIBRAMFS=y +CONFIG_LIBUKCPIO=y +CONFIG_LIBLWIP=y +CONFIG_LIBUKRANDOM=y +CONFIG_LIBUKRANDOM_GETRANDOM=y +CONFIG_STACK_SIZE_PAGE_ORDER=10 diff --git a/python3.10-http-server/scripts/defconfig/fc.x86_64 b/python3.10-http-server/scripts/defconfig/fc.x86_64 new file mode 100644 index 00000000..0f10eede --- /dev/null +++ b/python3.10-http-server/scripts/defconfig/fc.x86_64 @@ -0,0 +1,14 @@ +CONFIG_ARCH_X86_64=y +CONFIG_PLAT_KVM=y +CONFIG_KVM_PLAT_FC=y +CONFIG_APPPYTHON3_HTTP_SERVER=y +CONFIG_LIBPYTHON3=y +CONFIG_LIBPYTHON3_MAIN_FUNCTION=y +CONFIG_LIBPOSIX_VFS_FSTAB=y +CONFIG_LIBPOSIX_VFS_FSTAB_BUILTIN_RAMFS=y +CONFIG_LIBRAMFS=y +CONFIG_LIBUKCPIO=y +CONFIG_LIBLWIP=y +CONFIG_LIBUKRANDOM=y +CONFIG_LIBUKRANDOM_GETRANDOM=y +CONFIG_STACK_SIZE_PAGE_ORDER=10 diff --git a/python3.10-http-server/scripts/defconfig/qemu.arm64 b/python3.10-http-server/scripts/defconfig/qemu.arm64 new file mode 100644 index 00000000..13e0be72 --- /dev/null +++ b/python3.10-http-server/scripts/defconfig/qemu.arm64 @@ -0,0 +1,13 @@ +CONFIG_ARCH_ARM64=y +CONFIG_PLAT_KVM=y +CONFIG_APPPYTHON3_HTTP_SERVER=y +CONFIG_LIBPYTHON3=y +CONFIG_LIBPYTHON3_MAIN_FUNCTION=y +CONFIG_LIBPOSIX_VFS_FSTAB=y +CONFIG_LIBPOSIX_VFS_FSTAB_BUILTIN_RAMFS=y +CONFIG_LIBRAMFS=y +CONFIG_LIBUKCPIO=y +CONFIG_LIBLWIP=y +CONFIG_LIBUKRANDOM=y +CONFIG_LIBUKRANDOM_GETRANDOM=y +CONFIG_STACK_SIZE_PAGE_ORDER=10 diff --git a/python3.10-http-server/scripts/defconfig/qemu.x86_64 b/python3.10-http-server/scripts/defconfig/qemu.x86_64 new file mode 100644 index 00000000..c2e284f6 --- /dev/null +++ b/python3.10-http-server/scripts/defconfig/qemu.x86_64 @@ -0,0 +1,13 @@ +CONFIG_ARCH_X86_64=y +CONFIG_PLAT_KVM=y +CONFIG_APPPYTHON3_HTTP_SERVER=y +CONFIG_LIBPYTHON3=y +CONFIG_LIBPYTHON3_MAIN_FUNCTION=y +CONFIG_LIBPOSIX_VFS_FSTAB=y +CONFIG_LIBPOSIX_VFS_FSTAB_BUILTIN_RAMFS=y +CONFIG_LIBRAMFS=y +CONFIG_LIBUKCPIO=y +CONFIG_LIBLWIP=y +CONFIG_LIBUKRANDOM=y +CONFIG_LIBUKRANDOM_GETRANDOM=y +CONFIG_STACK_SIZE_PAGE_ORDER=10 diff --git a/python3.10-http-server/scripts/defconfig/xen.arm64 b/python3.10-http-server/scripts/defconfig/xen.arm64 new file mode 100644 index 00000000..52a2a731 --- /dev/null +++ b/python3.10-http-server/scripts/defconfig/xen.arm64 @@ -0,0 +1,13 @@ +CONFIG_ARCH_ARM64=y +CONFIG_PLAT_XEN=y +CONFIG_APP_PYHTON3_HTTP_SERVER=y +CONFIG_LIBPYTHON3=y +CONFIG_LIBPYTHON3_MAIN_FUNCTION=y +CONFIG_LIBPOSIX_VFS_FSTAB=y +CONFIG_LIBPOSIX_VFS_FSTAB_BUILTIN_RAMFS=y +CONFIG_LIBRAMFS=y +CONFIG_LIBUKCPIO=y +CONFIG_LIBLWIP=y +CONFIG_LIBUKRANDOM=y +CONFIG_LIBUKRANDOM_GETRANDOM=y +CONFIG_STACK_SIZE_PAGE_ORDER=10 diff --git a/python3.10-http-server/scripts/defconfig/xen.x86_64 b/python3.10-http-server/scripts/defconfig/xen.x86_64 new file mode 100644 index 00000000..733811c7 --- /dev/null +++ b/python3.10-http-server/scripts/defconfig/xen.x86_64 @@ -0,0 +1,13 @@ +CONFIG_ARCH_X86_64=y +CONFIG_PLAT_XEN=y +CONFIG_APP_PYHTON3_HTTP_SERVER=y +CONFIG_LIBPYTHON3=y +CONFIG_LIBPYTHON3_MAIN_FUNCTION=y +CONFIG_LIBPOSIX_VFS_FSTAB=y +CONFIG_LIBPOSIX_VFS_FSTAB_BUILTIN_RAMFS=y +CONFIG_LIBRAMFS=y +CONFIG_LIBUKCPIO=y +CONFIG_LIBLWIP=y +CONFIG_LIBUKRANDOM=y +CONFIG_LIBUKRANDOM_GETRANDOM=y +CONFIG_STACK_SIZE_PAGE_ORDER=10 diff --git a/python3.10-http-server/scripts/run/fc.arm64 b/python3.10-http-server/scripts/run/fc.arm64 new file mode 100755 index 00000000..efb2378a --- /dev/null +++ b/python3.10-http-server/scripts/run/fc.arm64 @@ -0,0 +1,22 @@ +#!/bin/sh + +if test ! -f "workdir/build/python3.10-http-server_fc-arm64"; then + echo "No kernel file workdir/build/python3.10-http-server_fc-arm64." 1>&2 + echo "Did you run ./build.fc.arm64 ?" 1>&2 + exit 1 +fi + +# Generate root filesystem from Dockerfile. +rm -fr ./rootfs +docker build -o ./rootfs -f Dockerfile . + +# Pack filesystem as an initial ramdisk CPIO file. +rm -f initrd.cpio +../repos/unikraft/support/scripts/mkcpio initrd.cpio ./rootfs/ + +# Remove previously created files. +rm -f firecracker.socket + +firecracker-aarch64 \ + --api-sock firecracker.socket \ + --config-file fc.arm64.json diff --git a/python3.10-http-server/scripts/run/fc.x86_64 b/python3.10-http-server/scripts/run/fc.x86_64 new file mode 100755 index 00000000..fed86b4b --- /dev/null +++ b/python3.10-http-server/scripts/run/fc.x86_64 @@ -0,0 +1,22 @@ +#!/bin/sh + +if test ! -f "workdir/build/python3.10-http-server_fc-x86_64"; then + echo "No kernel file workdir/build/python3.10-http-server_fc-x86_64." 1>&2 + echo "Did you run ./build.fc.x86_64 ?" 1>&2 + exit 1 +fi + +# Generate root filesystem from Dockerfile. +rm -fr ./rootfs +docker build -o ./rootfs -f Dockerfile . + +# Pack filesystem as an initial ramdisk CPIO file. +rm -f initrd.cpio +../repos/unikraft/support/scripts/mkcpio initrd.cpio ./rootfs/ + +# Remove previously created files. +rm -f firecracker.socket + +firecracker-x86_64 \ + --api-sock firecracker.socket \ + --config-file fc.x86_64.json diff --git a/python3.10-http-server/scripts/run/qemu.arm64 b/python3.10-http-server/scripts/run/qemu.arm64 new file mode 100755 index 00000000..13d7fc3c --- /dev/null +++ b/python3.10-http-server/scripts/run/qemu.arm64 @@ -0,0 +1,28 @@ +#!/bin/sh + +if test ! -f "workdir/build/python3.10-http-server_qemu-arm64"; then + echo "No kernel file workdir/build/python3.10-http-server_qemu-arm64." 1>&2 + echo "Did you run ./build.qemu.arm64 ?" 1>&2 + exit 1 +fi + +# Generate root filesystem from Dockerfile. +rm -fr ./rootfs +docker build -o ./rootfs -f Dockerfile . + +# Pack filesystem as an initial ramdisk CPIO file. +rm -f initrd.cpio +../repos/unikraft/support/scripts/mkcpio initrd.cpio ./rootfs/ + +qemu-system-aarch64 \ + -machine virt -cpu max \ + -m 256M \ + -nographic \ + -netdev user,id=net0,hostfwd=tcp:127.0.0.1:18080-:8080 \ + -device virtio-net-device,netdev=net0 \ + -kernel workdir/build/python3.10-http-server_qemu-arm64 \ + -initrd ./initrd.cpio \ + -append 'rootfstype=ramfs console=ttyAMA0 \ + vfs.fstab=["initrd0:/:extract::ramfs=1"] \ + env.vars=[PYTHONHOME="/usr/local/lib/python3.10" PYTHONPATH="/usr/local/lib/python3.10"] \ + -- /app/http-server.py' diff --git a/python3.10-http-server/scripts/run/qemu.x86_64 b/python3.10-http-server/scripts/run/qemu.x86_64 new file mode 100755 index 00000000..8a623b4d --- /dev/null +++ b/python3.10-http-server/scripts/run/qemu.x86_64 @@ -0,0 +1,28 @@ +#!/bin/sh + +if test ! -f "workdir/build/python3.10-http-server_qemu-x86_64"; then + echo "No kernel file workdir/build/python3.10-http-server_qemu-x86_64." 1>&2 + echo "Did you run ./build.qemu.x86_64 ?" 1>&2 + exit 1 +fi + +# Generate root filesystem from Dockerfile. +rm -fr ./rootfs +docker build -o ./rootfs -f Dockerfile . + +# Pack filesystem as an initial ramdisk CPIO file. +rm -f initrd.cpio +../repos/unikraft/support/scripts/mkcpio initrd.cpio ./rootfs/ + +qemu-system-x86_64 \ + -machine accel=tcg -cpu max \ + -m 256M \ + -nographic \ + -netdev user,id=net0,hostfwd=tcp:127.0.0.1:8080-:8080 \ + -device virtio-net-pci,netdev=net0 \ + -kernel workdir/build/python3.10-http-server_qemu-x86_64 \ + -initrd ./initrd.cpio \ + -append 'rootfstype=ramfs console=ttyS0 \ + vfs.fstab=["initrd0:/:extract::ramfs=1"] \ + env.vars=[PYTHONHOME="/usr/local/lib/python3.10" PYTHONPATH="/usr/local/lib/python3.10"] \ + -- /app/http-server.py' diff --git a/python3.10-http-server/scripts/run/xen.arm64 b/python3.10-http-server/scripts/run/xen.arm64 new file mode 100755 index 00000000..6af68642 --- /dev/null +++ b/python3.10-http-server/scripts/run/xen.arm64 @@ -0,0 +1,17 @@ +#!/bin/sh + +if test ! -f "workdir/build/python3.10-http-server_xen-arm64"; then + echo "No kernel file workdir/build/python3.10-http-server_xen-arm64." 1>&2 + echo "Did you run ./build.xen.arm64 ?" 1>&2 + exit 1 +fi + +# Generate root filesystem from Dockerfile. +rm -fr ./rootfs +docker build -o ./rootfs -f Dockerfile . + +# Pack filesystem as an initial ramdisk CPIO file. +rm -f initrd.cpio +../repos/unikraft/support/scripts/mkcpio initrd.cpio ./rootfs/ + +sudo xl create -c xen.arm64.cfg diff --git a/python3.10-http-server/scripts/run/xen.x86_64 b/python3.10-http-server/scripts/run/xen.x86_64 new file mode 100755 index 00000000..64444fdb --- /dev/null +++ b/python3.10-http-server/scripts/run/xen.x86_64 @@ -0,0 +1,17 @@ +#!/bin/sh + +if test ! -f "workdir/build/python3.10-http-server_xen-x86_64"; then + echo "No kernel file workdir/build/python3.10-http-server_xen-x86_64." 1>&2 + echo "Did you run ./build.xen.x86_64 ?" 1>&2 + exit 1 +fi + +# Generate root filesystem from Dockerfile. +rm -fr ./rootfs +docker build -o ./rootfs -f Dockerfile . + +# Pack filesystem as an initial ramdisk CPIO file. +rm -f initrd.cpio +../repos/unikraft/support/scripts/mkcpio initrd.cpio ./rootfs/ + +sudo xl create -c xen.x86_64.cfg diff --git a/python3.10-http-server/scripts/test/.gitignore b/python3.10-http-server/scripts/test/.gitignore new file mode 100644 index 00000000..8297d08b --- /dev/null +++ b/python3.10-http-server/scripts/test/.gitignore @@ -0,0 +1 @@ +/log/ diff --git a/python3.10-http-server/scripts/test/README.md b/python3.10-http-server/scripts/test/README.md new file mode 100644 index 00000000..e100dc72 --- /dev/null +++ b/python3.10-http-server/scripts/test/README.md @@ -0,0 +1,31 @@ +# Testing Python3.10 Http Server on Unikraft + +These are companion instructions to the main instructions in the [`README`](../../README.md) and to the scripted run instructions in the [`scripts/README`](../README.md). +Use these scripts to test Python3.10 Http Server on Unikraft. + +**Note**: Run scripts from the application directory. + +Use the `all.sh` script to test all builds and all available runs: + +```console +./scripts/test/all.sh +``` + +The command prints out a summary of the passed or failed tests. + +Logs are stored in the `./scripts/test/log/` directory. + +Use the `single.sh` script to only run a query test for a running instance. +That is, first run the instance, e.g: + +```console +./scripts/run/qemu.x86_64 +``` + +And then query it with the `single.sh` script: + +```console +./single.sh +``` + +The command prints out the output of the commands that query the instance. \ No newline at end of file diff --git a/python3.10-http-server/scripts/test/all.sh b/python3.10-http-server/scripts/test/all.sh new file mode 100755 index 00000000..259fd3a3 --- /dev/null +++ b/python3.10-http-server/scripts/test/all.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +test_build() +{ + printf "%-46s ... " build."$1" + ./scripts/build/"$1" > ./scripts/test/log/build."$1" 2>&1 + if test $? -eq 0; then + echo "PASSED" + else + echo "FAILED" + fi +} + +test_build_run() +{ + printf "%-46s ... " build."$1" + ./scripts/build/"$1" > ./scripts/test/log/build."$1" 2>&1 + if test $? -eq 0; then + echo "PASSED" + else + echo "FAILED" + fi + + printf " %-42s ... " run."$1" + ./scripts/test/wrapper.sh ./scripts/run/"$1" "$2" "$3" 2> ./scripts/test/log/run."$1" +} + +./setup.sh +test -d ./scripts/test/log || mkdir ./scripts/test/log + +test_build_run qemu.x86_64 127.0.0.1 8080 +test_build_run qemu.arm64 127.0.0.1 18080 +test_build_run fc.x86_64 172.44.0.2 8080 +test_build fc.arm64 +test_build xen.x86_64 +test_build xen.arm64 diff --git a/python3.10-http-server/scripts/test/common.sh b/python3.10-http-server/scripts/test/common.sh new file mode 100755 index 00000000..e7ef3126 --- /dev/null +++ b/python3.10-http-server/scripts/test/common.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +if test -z "$log_file"; then + log_file="/dev/null" +fi + +clean_up() +{ + { + # Clean up any previous instances. + sudo pkill -9 qemu-system + sudo pkill -9 firecracker + kraft stop --all + kraft rm --all + sudo kraft stop --all + sudo kraft rm --all + + # Remove previously created network interfaces. + sudo ip link set dev tap0 down + sudo ip link del dev tap0 + sudo ip link set dev virbr0 down + sudo ip link del dev virbr0 + } > /dev/null 2>&1 +} + +start_instance() +{ + # Start instance. + setsid --fork "$start_command" 1>&2 & + if test $? -ne 0; then + echo "Cannot start instance" 1>&2 + echo "FAILED" + clean_up + exit 1 + fi +} + +test_ping() +{ + host="$1" + + # Connect to instance. + ping -c 1 "$host" 1>&2 + if test $? -ne 0; then + echo "Cannot ping $host" 1>&2 + echo "FAILED" + clean_up + exit 1 + fi +} + +test_curl_connect() +{ + host="$1" + port="$2" + + # Query instance. + curl --retry 1 --connect-timeout 1 --max-time 10 "$host":"$port" 1>&2 + if test $? -ne 0; then + echo "Cannot connect to $host:$port" 1>&2 + echo "FAILED" + clean_up + exit 1 + fi +} + +test_curl_check_reply() +{ + host="$1" + port="$2" + message="$3" + + # Check server message contents. + curl --retry 1 --connect-timeout 1 --max-time 10 "$host":"$port" | grep "$message" 1>&2 + if test $? -ne 0; then + echo "Wrong message from $host:$port" 1>&2 + echo "FAILED" + clean_up + exit 1 + fi +} + +test_netcat_connect() +{ + host="$1" + port="$2" + + # Check connection. + netcat -w 3 "$host" "$port" < /dev/null 1>&2 + if test $? -ne 0; then + echo "Cannot connect to $host:$port" 1>&2 + echo "FAILED" + clean_up + exit 1 + fi +} + +end_with_success() +{ + echo "PASSED" + clean_up + exit 0 +} + +start_command="$1" diff --git a/python3.10-http-server/scripts/test/single.sh b/python3.10-http-server/scripts/test/single.sh new file mode 100755 index 00000000..e942a805 --- /dev/null +++ b/python3.10-http-server/scripts/test/single.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +. ./scripts/test/common.sh + +default_host=127.0.0.1 +default_port=8080 + +if test $# -eq 0; then + host="$default_host" + port="$default_port" +elif test $# -eq 2; then + host="$1" + port="$2" +else + echo "Usage: $0 [ ]" 1>&2 + exit 1 +fi + +echo "Using as remote $host:$port" 1>&2 + +test_curl_connect "$host" "$port" +test_curl_check_reply "$host" "$port" "Directory listing" + +end_with_success diff --git a/python3.10-http-server/scripts/test/wrapper.sh b/python3.10-http-server/scripts/test/wrapper.sh new file mode 100755 index 00000000..dc4f3491 --- /dev/null +++ b/python3.10-http-server/scripts/test/wrapper.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +. ./scripts/test/common.sh + +default_host=127.0.0.1 +default_port=8080 + +if test $# -eq 1; then + host="$default_host" + port="$default_port" +elif test $# -eq 3; then + host="$2" + port="$3" +else + echo "Usage: $0 [ ]" 1>&2 + exit 1 +fi + +echo "Using as remote $host:$port" 1>&2 + +clean_up +start_instance +sleep 10 + +./scripts/test/single.sh "$host" "$port" +if test $? -ne 0; then + echo "Test failed for $host:$port" 1>&2 + clean_up + exit 1 +fi + +end_with_success