THIS is just for testing -> is not meant to be applied to OSv github tree.

Helps recreating and testing issues #536, #1010 and #1018

Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
 fpu_test_scripts/poll_threads.sh              | 16 +++++
 fpu_test_scripts/run_cassandra.sh             | 19 ++++++
 fpu_test_scripts/run_ffmpeg_extract_frames.sh | 54 +++++++++++++++
 fpu_test_scripts/run_ffmpeg_transcode_x265.sh | 65 +++++++++++++++++++
 4 files changed, 154 insertions(+)
 create mode 100755 fpu_test_scripts/poll_threads.sh
 create mode 100755 fpu_test_scripts/run_cassandra.sh
 create mode 100755 fpu_test_scripts/run_ffmpeg_extract_frames.sh
 create mode 100755 fpu_test_scripts/run_ffmpeg_transcode_x265.sh

diff --git a/fpu_test_scripts/poll_threads.sh b/fpu_test_scripts/poll_threads.sh
new file mode 100755
index 00000000..3013c942
--- /dev/null
+++ b/fpu_test_scripts/poll_threads.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+while true
+do
+  HTTP_RESPONSE=`curl -s -w "HTTPCODE:%{http_code}" 
http://localhost:8000/os/threads`
+
+  HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPCODE\:.*//g')
+
+  HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPCODE://')
+  printf "HTTP code: $HTTP_STATUS\n"
+  if [ ! $HTTP_STATUS -eq 200 ]; then
+    exit 1
+  fi
+
+  sleep .1
+done
diff --git a/fpu_test_scripts/run_cassandra.sh 
b/fpu_test_scripts/run_cassandra.sh
new file mode 100755
index 00000000..8c830c86
--- /dev/null
+++ b/fpu_test_scripts/run_cassandra.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# 
+# Commands helpful to replicate issue #536
+
+#
+# Build:
+./scripts/build image=cassandra,httpserver-html5-gui
+
+# In 1st window run cassandra on OSv
+sudo ./scripts/run.py -nv -m 4G -c 1
+
+# In 2nd window keep getting OSv thread info
+while :; do curl http://192.168.122.76:8000/os/threads > /dev/null;done
+
+# In 3rd window execute cassandra stress test
+# May need to execute number of times until error is reproduced
+OSV_PATH=$(pwd $0)/..
+$OSV_PATH/apps/cassandra/upstream/apache-cassandra-2.1.0/tools/bin$ 
./cassandra-stress write -node 192.168.122.76 -rate threads=50 && 
./cassandra-stress read -node 192.168.122.76 -rate threads=50
diff --git a/fpu_test_scripts/run_ffmpeg_extract_frames.sh 
b/fpu_test_scripts/run_ffmpeg_extract_frames.sh
new file mode 100755
index 00000000..1bd111aa
--- /dev/null
+++ b/fpu_test_scripts/run_ffmpeg_extract_frames.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+#
+# Script helpful to replicate issue #1010
+
+#
+# Build
+# ./scripts/build image=ffmpeg,httpserver-html5-gui.fg
+
+# In 1st start OSv with REST API httpserver listening for commands
+# ./scripts/run.py -e '/libhttpserver-api.so' --api
+
+# In 2nd window keep getting OSv thread info using poll_threads.sh
+
+# In 3rd window run this script (takes number of times ffpmeg will be executed 
- up to 32 times)
+# It keeps executing ffmpeg to extract frames from supplied video URL
+COUNT=$1
+COMMAND='/ffmpeg.so -i http://clips.vorwaerts-gmbh.de/VfE_html5.mp4 -r 1 -f 
image2 image-%2d.png'
+
+make_api_call()
+{
+  METHOD=$1
+  URL=$2
+  HTTP_RESPONSE=$(curl -X${METHOD} -s -w "HTTPCODE:%{http_code}" 
http://localhost:8000${URL})
+
+  HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPCODE\:.*//g')
+  #echo $HTTP_BODY
+
+  HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPCODE://')
+  if [ ! $HTTP_STATUS -eq 200 ]; then
+    printf "HTTP code: $HTTP_STATUS\n"
+    exit 1
+  fi
+}
+
+while [ $COUNT -ge 0 ]
+do
+  make_api_call PUT 
'/app/?command=%2Fffmpeg.so%20-i%20http%3A%2F%2Fclips.vorwaerts-gmbh.de%2FVfE_html5.mp4%20-r%201%20-f%20image2%20image-%252d.png&new_program=true'
+  TID=$(echo $HTTP_BODY | grep -oP "\d+")
+  echo "App TID: $TID"
+  printf "Checking statue of $TID "
+
+  FINISHED=0
+  while [ $FINISHED -eq 0 ]
+  do
+    sleep 1
+    printf "."
+    make_api_call GET "/app/finished/?tid=$TID"
+    FINISHED=$(echo $HTTP_BODY | grep -oP "\d+")
+  done
+
+  printf "\n"
+  COUNT=$((COUNT-1))
+done
diff --git a/fpu_test_scripts/run_ffmpeg_transcode_x265.sh 
b/fpu_test_scripts/run_ffmpeg_transcode_x265.sh
new file mode 100755
index 00000000..9386e984
--- /dev/null
+++ b/fpu_test_scripts/run_ffmpeg_transcode_x265.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+#
+# Script helpful to replicate issue #1018
+
+#
+# Build (please not you need to uncommend line in apps/ffmpeg/Makefile to 
enabled x265 code compiliation
+# ./scripts/build image=ffmpeg,httpserver-html5-gui.fg
+
+# In 1st start OSv with REST API httpserver listening for commands
+# ./scripts/run.py -e '/libhttpserver-api.so' --api
+
+# In 2nd window keep getting OSv thread info using poll_threads.sh
+
+# In 3rd window run this script (takes number of times ffpmeg will be executed 
- up to 32 times)
+# It starts ffmpeg on a host to listen for incoming transcoded video stream 
and then
+# send a request to OSv to start ffmpeg to transcode video 
http://clips.vorwaerts-gmbh.de/VfE_html5.mp4
+# to h265 and send it over network to ther ffmpeg instance running on the host
+
+COUNT=$1
+OSV_PATH=$(pwd $0)/..
+FFMPEG_DIR=$OSV_PATH/apps/ffmpeg/ROOTFS
+COMMAND='/ffmpeg.so -i http://clips.vorwaerts-gmbh.de/VfE_html5.mp4 -c:v 
libx265 -crf 28 -c:a aac -b:a 128k -f mpegts tcp://192.168.122.1:12345'
+
+make_api_call()
+{
+  METHOD=$1
+  URL=$2
+  HTTP_RESPONSE=$(curl -X${METHOD} -s -w "HTTPCODE:%{http_code}" 
http://localhost:8000${URL})
+
+  HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPCODE\:.*//g')
+  #echo $HTTP_BODY
+
+  HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPCODE://')
+  if [ ! $HTTP_STATUS -eq 200 ]; then
+    printf "HTTP code: $HTTP_STATUS\n"
+    exit 1
+  fi
+}
+
+while [ $COUNT -ge 0 ]
+do
+  #Start ffmpeg TCP listener  
+  rm -f $HOME/test.mp4
+  export LD_LIBRARY_PATH=$FFMPEG_DIR 
+  $FFMPEG_DIR/ffmpeg.so -i tcp://0.0.0.0:12345?listen -c copy $HOME/test.mp4 
1>/dev/null 2>/dev/null &
+  sleep .5
+
+  make_api_call PUT 
'/app/?command=%2Fffmpeg.so%20-i%20http%3A%2F%2Fclips.vorwaerts-gmbh.de%2FVfE_html5.mp4%20-c%3Av%20libx265%20-crf%2028%20-c%3Aa%20aac%20-b%3Aa%20128k%20-f%20mpegts%20tcp%3A%2F%2F192.168.122.1%3A12345&new_program=true'
+  TID=$(echo $HTTP_BODY | grep -oP "\d+")
+  echo "App TID: $TID"
+  printf "Checking statue of $TID "
+
+  FINISHED=0
+  while [ $FINISHED -eq 0 ]
+  do
+    sleep 1
+    printf "."
+    make_api_call GET "/app/finished/?tid=$TID"
+    FINISHED=$(echo $HTTP_BODY | grep -oP "\d+")
+  done
+
+  printf "\n"
+  COUNT=$((COUNT-1))
+done
-- 
2.19.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to