Skip to content

Commit

Permalink
ci: automated tests test with multiple scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Ionut Muthi <[email protected]>
  • Loading branch information
IonutMuthi committed Jun 19, 2024
1 parent d5a7920 commit 94255e1
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ set(SCOPY_SOURCE_PATH ${CMAKE_SOURCE_DIR} CACHE STRING "SCOPY_SOURCE_PATH" FORCE


#SCOPY BASE TESTS
add_test(NAME "DeviceConnectionJSTest" COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/automatedJSTests/scopyDeviceConnectionTest.sh)
#add_test(NAME "DeviceConnectionJSTest" COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/automatedJSTests/scopyDeviceConnectionTest.sh)
add_test(NAME "SwitchToolJSTest" COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/automatedJSTests/scopySwitchToolTest.sh)


# PLUGIN SPECIFIC TESTS
Expand Down
9 changes: 9 additions & 0 deletions tests/automatedJSTests/scopyDeviceConnect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* main function */
function main(){
//CONNECT TO EMU
var deviceID = scopy.addDevice("", "ip:127.0.0.0")
//CONNECT TO DEVICE
scopy.connectDevice(deviceID)
}

main()
9 changes: 9 additions & 0 deletions tests/automatedJSTests/scopyDeviceDisconnect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* main function */
function main(){
//DISCONNECT FROM DEVICE
scopy.disconnectDevice()

exit(0)
}

main()
10 changes: 10 additions & 0 deletions tests/automatedJSTests/scopySWitchToolTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* main function */
function main(){

scopy.switchTool("Time")
scopy.switchTool("DataLogger 0")
scopy.switchTool("Debugger")
scopy.switchTool("Register Map")
}

main()
26 changes: 26 additions & 0 deletions tests/automatedJSTests/scopySwitchToolTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /bin/bash

# get scopy buil path from CMakeCache.txt
scopyBuildDir=$(grep 'SCOPY_BUILD_PATH' ../CMakeCache.txt | awk -F= '{print $2}')
scopySourceDir=$(grep 'SCOPY_SOURCE_PATH' ../CMakeCache.txt | awk -F= '{print $2}')

connectScript=$(find $scopySourceDir -name "scopyDeviceConnect.js");
switchToolScript=$(find $scopySourceDir -name "scopySWitchToolTest.js");
disconnectScript=$(find $scopySourceDir -name "scopyDeviceDisconnect.js");


if [ ! -z $connectScript ]; then
# start emu
emuXmlPath="$scopySourceDir/tests/emuXml";
cd $emuXmlPath
iio-emu generic *.xml &

# go to where scopy is build and run it with the scipt
cd $scopyBuildDir
# QT_QPA_PLATFORM=offscreen
./scopy --script-list={"$connectScript","$switchToolScript","$disconnectScript"}

#stop emu
killall -9 iio-emu
fi

0 comments on commit 94255e1

Please sign in to comment.