summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphilippe colliot <philippe.colliot@mpsa.com>2014-08-04 18:05:19 +0200
committerphilippe colliot <philippe.colliot@mpsa.com>2014-08-04 18:05:19 +0200
commitbc2fe3369a425e48064ec507206c2d6410e0543d (patch)
tree01fc09bd45cf5554e68db7999b49ed27015546bc
parentb5d53aec423b420da3249342803bc68a04be7a45 (diff)
downloadpoi-service-bc2fe3369a425e48064ec507206c2d6410e0543d.tar.gz
add a script to investigate overload issue
-rwxr-xr-xsrc/navigation/script/run28
-rw-r--r--test/navigation/intensive-testing.py118
-rw-r--r--test/navigation/test.log19
3 files changed, 164 insertions, 1 deletions
diff --git a/src/navigation/script/run b/src/navigation/script/run
index 5963326..18363c6 100755
--- a/src/navigation/script/run
+++ b/src/navigation/script/run
@@ -22,6 +22,7 @@
# List of changes:
#
# 26-6-2014, Marco Residori, Added support of new EnhancedPositionService
+# 4-8-2014, Philippe Colliot, Add some wait for dbus service
#
# @licence end@
function run
@@ -58,6 +59,19 @@ function run
PIDS="$PIDS $!"
}
+function wait_for_service
+{
+ for i in $(seq 1 50)
+ do
+ if dbus-send --dest=$1 $2 org.freedesktop.DBus.Introspectable.Introspect
+ then
+ return
+ fi
+ echo "Waiting for $1"
+ sleep 0.1
+ done
+}
+
function terminate
{
set +e
@@ -128,6 +142,9 @@ trap "terminate" EXIT INT
set -e
if [ "$enhpos" = 1 ]
then
+ run EnhancedPositionService $BIN_DIR/positioning/enhanced-position-service/src/enhanced-position-service
+ wait_for_service org.genivi.positioning.EnhancedPosition /org/genivi/positioning/EnhancedPosition
+
if [ "$replayer" = 1 ]
then
if [ -z "$REPLAYER_LOG_FILE" ]
@@ -136,11 +153,20 @@ then
fi
run LogReplayer $BIN_DIR/positioning/log-replayer/src/log-replayer $REPLAYER_LOG_FILE
fi
- run EnhancedPositionService $BIN_DIR/positioning/enhanced-position-service/src/enhanced-position-service
fi
cd $BIN_DIR/navit/navit
>bookmark.txt
echo "$center" >center.txt
run MapViewer ./navit navit_genivi_mapviewer.xml
+wait_for_service org.genivi.mapviewer.Configuration /org/genivi/mapviewer
+wait_for_service org.genivi.mapviewer.MapViewerControl /org/genivi/mapviewer
+wait_for_service org.genivi.mapviewer.Session /org/genivi/mapviewer
+
run NavigationCore ./navit navit_genivi_navigationcore.xml
+wait_for_service org.genivi.navigationcore.Configuration /org/genivi/navigationcore
+wait_for_service org.genivi.navigationcore.Guidance /org/genivi/navigationcore
+wait_for_service org.genivi.navigationcore.LocationInput /org/genivi/navigationcore
+wait_for_service org.genivi.navigationcore.MapMatchedPosition /org/genivi/navigationcore
+wait_for_service org.genivi.navigationcore.Routing /org/genivi/navigationcore
+wait_for_service org.genivi.navigationcore.Session /org/genivi/navigationcore
wait
diff --git a/test/navigation/intensive-testing.py b/test/navigation/intensive-testing.py
new file mode 100644
index 0000000..dde955e
--- /dev/null
+++ b/test/navigation/intensive-testing.py
@@ -0,0 +1,118 @@
+#!/usr/bin/python
+
+"""
+**************************************************************************
+* @licence app begin@
+* SPDX-License-Identifier: MPL-2.0
+*
+* \copyright Copyright (C) 2014, PCA Peugeot Citroen
+*
+* \file intensive-testing.py
+*
+* \brief This script tests the enhanced position by using the logreplayer at a given frame rate.
+*
+* \author Philippe Colliot <philippe.colliot@mpsa.com>
+*
+* \version 1.0
+*
+* This Source Code Form is subject to the terms of the
+* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+# this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+* List of changes:
+* <date>, <name>, <description of change>
+*
+* @licence end@
+**************************************************************************
+"""
+import sys,tty,termios,select,gobject,time,dbus,re,argparse,subprocess,signal
+
+from subprocess import call
+from subprocess import Popen
+from threading import Timer
+from enum import Enum
+from dbus.mainloop.glib import DBusGMainLoop
+from traceback import print_exc
+
+# Define some constants
+PERIODICITY_TESTING = 200 #in ms
+DURATION_TESTING = 20000 #in ms
+MAX_LOOP_TESTING = DURATION_TESTING/PERIODICITY_TESTING
+PATH_ENHANCEDPOSITION='../../src/navigation/bin/positioning/enhanced-position-service/src/'
+PATH_LOGREPLAYER='../../src/navigation/bin/positioning/log-replayer/src/'
+PATH_LOGFILES='./'
+
+def startEnhancedPositionServer():
+ enhancedposition=PATH_ENHANCEDPOSITION + 'enhanced-position-service'
+ arguments='> /dev/null 2>&1 &'
+ pid = Popen([enhancedposition, arguments])
+ return pid
+
+def launchLog(file):
+ logreplayer=PATH_LOGREPLAYER + 'log-replayer'
+ file=PATH_LOGFILES + file
+ arguments='> /dev/null 2>&1 &'
+ call([logreplayer, file, arguments])
+
+class Genivi(Enum):
+ ENHANCEDPOSITIONSERVICE_LATITUDE = 0x0020
+ ENHANCEDPOSITIONSERVICE_LONGITUDE = 0x0021
+ ENHANCEDPOSITIONSERVICE_ALTITUDE = 0x0022
+
+def loopDbus():
+ global testCounter
+ # launch the logreplayer with test file
+ launchLog("test.log")
+ # get the geolocation
+ geoLocation = enhancedPositionInterface.GetData(dbus.Array([Genivi.ENHANCEDPOSITIONSERVICE_LATITUDE,Genivi.ENHANCEDPOSITIONSERVICE_LONGITUDE]))
+ latitude=float(geoLocation[dbus.UInt16(Genivi.ENHANCEDPOSITIONSERVICE_LATITUDE)])
+ longitude=float(geoLocation[dbus.UInt16(Genivi.ENHANCEDPOSITIONSERVICE_LONGITUDE)])
+ testCounter += 1
+ print str(testCounter), str(latitude), str(longitude)
+ if testCounter >= MAX_LOOP_TESTING:
+ cleanExit()
+ return True
+
+def cleanExit():
+ global enhancedpositionPid
+ enhancedpositionPid.kill()
+ sys.exit(1)
+
+def exitProg(signum, frame):
+ # restore the original signal handler and exit
+ signal.signal(signal.SIGINT, original_sigint)
+ cleanExit()
+
+# Main program begins here
+parser = argparse.ArgumentParser(description='Intensive testing of enhanced position.')
+
+# Start the enhanced position server
+enhancedpositionPid = startEnhancedPositionServer()
+time.sleep(.5)
+
+# Initialize DBus loop as the main loop
+DBusGMainLoop(set_as_default=True)
+
+# Connect on the bus
+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+dbusConnectionBus = dbus.SessionBus()
+
+# Enhanced position
+try:
+ enhancedPositionObject = dbusConnectionBus.get_object("org.genivi.positioning.EnhancedPosition", "/org/genivi/positioning/EnhancedPosition")
+except dbus.DBusException:
+ print "connection to Enhanced position failed"
+ print_exc()
+ cleanExit()
+
+enhancedPositionInterface = dbus.Interface(enhancedPositionObject, "org.genivi.positioning.EnhancedPosition")
+
+# Start
+testCounter=0
+original_sigint = signal.getsignal(signal.SIGINT)
+signal.signal(signal.SIGINT, exitProg)
+gobject.timeout_add(PERIODICITY_TESTING,loopDbus)
+loop = gobject.MainLoop()
+loop.run()
+
+
+
diff --git a/test/navigation/test.log b/test/navigation/test.log
new file mode 100644
index 0000000..79bb1a9
--- /dev/null
+++ b/test/navigation/test.log
@@ -0,0 +1,19 @@
+#SPDX-License-Identifier: CC-BY-SA-4.0
+#Log file for the FSA simulator
+#GNS version 2.0.0
+#SNS version 2.0.0
+#VEH version 0.0.0 (alpha)
+#localization geneve cologny
+#vehicle speed 90 km/h so 2500 cm/1000 ms
+#engine speed 2000 RPM
+#ignition key ON (Not Applicable)
+#fuel level 30 l
+#fuel consumption 5.4 l/h so 1500 µl/1000 ms (6 l/100)
+#step 1000 ms
+#totalodo is used for simulating distance step in cm
+0,0$GVGNSVER,2,0,0
+0,0$GVSNSVER,2,0,0
+0,0$GVVEHVER,0,0,0
+1000,0$GVGNSP,1000,46.201839,6.146647,0,0X03
+1000,0$GVSNSVEHSP,1000,90.00,0X01
+1000,0$GVGNSC,1000,11.111111,0,27.000000,0X05