From aa0821726682aab62a501a67ddfc342c3f23053e Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Thu, 3 Oct 2013 14:43:49 +0200 Subject: HostDomainGenerator: Do not try to use port if already in use BZ: 144262 Currently, the hostDomainGenerator script doesn't check if the port used by the testPlatform is already used. This patch adds this new check. Change-Id: I323575f97f7437c01ce4e2d0b127aa658639af06 Signed-off-by: Kevin Rocard Reviewed-on: http://android.intel.com:8080/136085 Reviewed-by: Boisnard, FredericX Reviewed-by: De Chivre, Renaud Tested-by: Barthes, FabienX Reviewed-by: cactus Tested-by: cactus --- tools/xmlGenerator/hostDomainGenerator.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools') diff --git a/tools/xmlGenerator/hostDomainGenerator.sh b/tools/xmlGenerator/hostDomainGenerator.sh index 600c326..1d4d79b 100755 --- a/tools/xmlGenerator/hostDomainGenerator.sh +++ b/tools/xmlGenerator/hostDomainGenerator.sh @@ -127,12 +127,21 @@ formatConfigFile () { "$hostConfig" $PFWSocket "$(readlink -f "$(dirname "$1")")" <"$1" } +# Test if socket is currently used +portIsInUse () { + port=$1 + test $(ss -an src :${port} | wc --lines) -gt 1 +} + # The initTestPlatform starts a testPlatform instance with the config file given in argument. # It will also set the PFWSocket global variable to the PFW remote processor listening socket. initTestPlatform () { # Format the PFW config file formatConfigFile "$1" >"$tmpFile" + # Check port is free + ! portIsInUse $TPSocket || return 4 + # Start test platform $testPlatform "$tmpFile" $TPSocket 2>&5 & testPlatformPID=$! @@ -161,6 +170,10 @@ launchTestPlatform () { $TPSendCommand setFailureOnMissingSubsystem false $TPSendCommand setFailureOnFailedSettingsLoad false + + # Check port is free + ! portIsInUse $PFWSocket || return 5 + $TPSendCommand start if ! retry "$remoteProcess $PFWHost $PFWSocket help" 2 0.1 then -- cgit v1.1