-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ionut Muthi <[email protected]>
- Loading branch information
1 parent
e310a7d
commit d5a7920
Showing
7 changed files
with
188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#! /bin/bash | ||
|
||
# run all the tests in this file as CTest ?? in CMAKE | ||
|
||
# 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}') | ||
|
||
isEmuRunning=TRUE | ||
|
||
testScript=$(find $scopySourceDir -name "dataLoggerAutomatedTest.js"); | ||
if [ ! -z $testScript ]; then | ||
|
||
#check if emu is running | ||
if ! pgrep -x "iio-emu" > /dev/null | ||
then | ||
# if no emu running start emu for datalogger | ||
isEmuRunning=FALSE | ||
emuXmlPath=$scopySourceDir/plugins/datalogger/test/emuXml | ||
cd $emuXmlPath | ||
iio-emu generic *.xml & | ||
fi | ||
|
||
cd $scopyBuildDir | ||
# run scopy with the wanted script | ||
QT_QPA_PLATFORM=offscreen ./scopy -s "$testScript" | ||
|
||
# kill emu process if started by this test | ||
if [ "$isEmuRunning" = FALSE ]; then | ||
#stop emu | ||
killall -9 iio-emu | ||
fi | ||
fi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
|
||
/* log data test */ | ||
function logData(tool, filePath, selectedMonitors) { | ||
datalogger.enableMonitorOfTool(tool, selectedMonitors[0]) | ||
datalogger.enableMonitorOfTool(tool, selectedMonitors[1]) | ||
datalogger.clearData() | ||
msleep(500) | ||
datalogger.setRunning(true) | ||
msleep(1000) | ||
datalogger.logAtPathForTool(tool, filePath) | ||
datalogger.continuousLogAtPathForTool(tool, filePath) | ||
msleep(5000) | ||
datalogger.disableMonitorOfTool(tool, selectedMonitors[0]) | ||
datalogger.disableMonitorOfTool(tool, selectedMonitors[1]) | ||
datalogger.setRunning(false) | ||
datalogger.stopContinuousLogForTool(tool) | ||
|
||
printToConsole("Data logged for tool : " + tool + " at :" + filePath) | ||
} | ||
|
||
/* load data test */ | ||
function loadData(tool, filePath, selectedMonitors) { | ||
|
||
datalogger.importDataFromPathForTool(tool, filePath) | ||
msleep(500) | ||
datalogger.enableMonitorOfTool(tool, "Import: test.csv:" + selectedMonitors[0]) | ||
datalogger.enableMonitorOfTool(tool, "Import: test.csv:" + selectedMonitors[1]) | ||
|
||
printToConsole("Data loaded for tool : " + tool + " from :" + filePath) | ||
} | ||
|
||
function createTool(deviceID){ | ||
var newTool = datalogger.createTool() | ||
if (newTool !== "") { | ||
scopy.switchTool(deviceID, newTool) | ||
printToConsole("New tool created: " + newTool) | ||
} else { | ||
printToConsole("ERROR: Tool creation failed") | ||
exit(1) | ||
} | ||
return "DataLogger 1" | ||
} | ||
|
||
function getMonitors(tool){ | ||
var monitors = datalogger.showAvailableMonitors() | ||
printToConsole("Monitors list: " + monitors) | ||
var monitorList = monitors.split(/\n/) | ||
var voltage0Monitor = monitorList[2] | ||
printToConsole("Monitor1 : " + voltage0Monitor) | ||
var voltage1Monitor = monitorList[3] | ||
printToConsole("Monitor2 : " + voltage1Monitor) | ||
var selectedMonitors = [] | ||
selectedMonitors[0] = voltage0Monitor | ||
selectedMonitors[1] = voltage1Monitor | ||
|
||
return selectedMonitors | ||
} | ||
|
||
/* main function */ | ||
function main(){ | ||
//TODO REPLACE WITH VAR | ||
const filePath = "/home/ubuntu/Documents/git/scopy/dev/plugins/datalogger/test/automatedTests" + "/test.csv" | ||
|
||
printToConsole("FILE IS " + filePath) | ||
//CONNECT TO EMU | ||
var deviceID = scopy.addDevice("", "ip:127.0.0.0") | ||
scopy.connectDevice(deviceID) | ||
|
||
//TEST DATA LOGGER | ||
printToConsole(datalogger.showAvailableMonitors()) | ||
|
||
//CREATE NEW TOOL | ||
var tool = createTool(deviceID) | ||
|
||
printToConsole("FILE IS " + tool) | ||
|
||
if (tool !== "") { | ||
//GET 2 CHANNELS OF THE TOOL | ||
var selectedMonitors = getMonitors(tool) | ||
printToConsole("Monitors : " + selectedMonitors) | ||
//LOG DATA ON THE TOOL CHANNELS | ||
logData(tool, filePath, selectedMonitors) | ||
msleep(2000) | ||
//LOAD DATA FOR THE TOOL CHANNELS | ||
loadData(tool, filePath, selectedMonitors) | ||
msleep(2000) | ||
} | ||
|
||
} | ||
|
||
main() |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
include(ScopyTest) | ||
|
||
# JS AUTOMATED TESTS | ||
|
||
# Set build path as CMAKE CACHE variable to use in tests | ||
set(SCOPY_BUILD_PATH ${CMAKE_BINARY_DIR} CACHE STRING "SCOPY_BUILD_PATH" FORCE) | ||
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) | ||
|
||
|
||
# PLUGIN SPECIFIC TESTS | ||
|
||
# DATALOGGER SPECIFIC TESTS | ||
add_test(NAME "DataLoggerJSTest" COMMAND bash ${CMAKE_SOURCE_DIR}/plugins/datalogger/test/dataLoggerAtuomatedTest.sh) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* main function */ | ||
function main(){ | ||
//CONNECT TO EMU | ||
var deviceID = scopy.addDevice("", "ip:127.0.0.0") | ||
//CONNECT TO DEVICE | ||
scopy.connectDevice(deviceID) | ||
//DISCONNECT FROM DEVICE | ||
scopy.disconnectDevice(deviceID) | ||
|
||
exit(0) | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#! /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}') | ||
|
||
testScript=$(find $scopySourceDir -name "scopyDeviceConnectionTest.js"); | ||
|
||
if [ ! -z $testScript ]; 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 -s "$testScript" | ||
|
||
#stop emu | ||
killall -9 iio-emu | ||
fi | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.