From 7895a7b526f912b2925827128c3583b87d1683f9 Mon Sep 17 00:00:00 2001 From: Marcelina Oset Date: Thu, 5 Jan 2023 12:03:53 +0100 Subject: [PATCH] [#39898] Merged script for testing png/svg/txt and html plot into one file --- .ci.yml | 8 +++---- scripts/{tests/simple_test.sh => test.sh} | 28 ++++++++++++++++------- scripts/tests/interactive_plot_test.sh | 20 ---------------- 3 files changed, 24 insertions(+), 32 deletions(-) rename scripts/{tests/simple_test.sh => test.sh} (51%) delete mode 100644 scripts/tests/interactive_plot_test.sh diff --git a/.ci.yml b/.ci.yml index 2178737..5bf5c6c 100644 --- a/.ci.yml +++ b/.ci.yml @@ -8,8 +8,8 @@ simple_test: FAKE_DISK: "fake_disk.ext4" FAKE_MOUNTPOINT: "fake_mountpoint" script: - - chmod +x scripts/tests/simple_test.sh - - ./scripts/tests/simple_test.sh + - chmod +x scripts/test.sh + - ./scripts/test.sh svg png ascii artifacts: when: always paths: @@ -24,8 +24,8 @@ interactive_plot_test: FAKE_DISK: "fake_disk.ext4" FAKE_MOUNTPOINT: "fake_mountpoint" script: - - chmod +x scripts/tests/interactive_plot_test.sh - - ./scripts/tests/interactive_plot_test.sh + - chmod +x scripts/test.sh + - ./scripts/test.sh html artifacts: when: always paths: diff --git a/scripts/tests/simple_test.sh b/scripts/test.sh similarity index 51% rename from scripts/tests/simple_test.sh rename to scripts/test.sh index bd886e5..f3daf54 100644 --- a/scripts/tests/simple_test.sh +++ b/scripts/test.sh @@ -1,5 +1,10 @@ #!/bin/bash +if [[ "$@" =~ 'html' ]] +then + pip install git+https://github.com/antmicro/servis#egg=servis[bokeh] +fi + dd if=/dev/zero of=$FAKE_DISK bs=1M count=130 mkfs.ext4 $FAKE_DISK mkdir -p $FAKE_MOUNTPOINT && mount $FAKE_DISK $FAKE_MOUNTPOINT @@ -12,15 +17,22 @@ stress -c 16 -i 1 -m 1 --vm-bytes 512M -d 1 --hdd-bytes 70M -t 160s popd -sargraph chart save plot.svg -sargraph chart save plot.png -sargraph chart save plot.ascii +for ext in "$@" +do + sargraph chart save "plot.${ext}" +done + sargraph chart stop -test -f plot.svg -test -f plot.png -test -f plot.ascii +for ext in "$@" +do + test -f "plot.${ext}" +done cat chart.log -echo '------Sample plot------' -cat plot.ascii \ No newline at end of file + +if [[ "$@" =~ 'ascii' ]] +then + echo '------Sample plot------' + cat plot.ascii +fi \ No newline at end of file diff --git a/scripts/tests/interactive_plot_test.sh b/scripts/tests/interactive_plot_test.sh deleted file mode 100644 index 71a0750..0000000 --- a/scripts/tests/interactive_plot_test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -pip install git+https://github.com/antmicro/servis#egg=servis[bokeh] -dd if=/dev/zero of=$FAKE_DISK bs=1M count=130 -mkfs.ext4 $FAKE_DISK -mkdir -p $FAKE_MOUNTPOINT && mount $FAKE_DISK $FAKE_MOUNTPOINT - -sargraph chart start -m $FAKE_MOUNTPOINT - -pushd $FAKE_MOUNTPOINT -df -h . -stress -c 16 -i 1 -m 1 --vm-bytes 512M -d 1 --hdd-bytes 70M -t 160s - -popd - -sargraph chart save plot.html -sargraph chart stop - -test -f plot.html -cat chart.log \ No newline at end of file