diff options
author | Kevin Rocard <kevinx.rocard@intel.com> | 2013-10-03 14:43:49 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-12 17:04:11 +0100 |
commit | aa0821726682aab62a501a67ddfc342c3f23053e (patch) | |
tree | 696c359d5ec5f9b109f5b28c9abf285bb1881e53 | |
parent | 5f8cecf6c7f974bb3543d2f7629d78e0f57d8425 (diff) | |
download | external_parameter-framework-aa0821726682aab62a501a67ddfc342c3f23053e.zip external_parameter-framework-aa0821726682aab62a501a67ddfc342c3f23053e.tar.gz external_parameter-framework-aa0821726682aab62a501a67ddfc342c3f23053e.tar.bz2 |
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 <kevinx.rocard@intel.com>
Reviewed-on: http://android.intel.com:8080/136085
Reviewed-by: Boisnard, FredericX <fredericx.boisnard@intel.com>
Reviewed-by: De Chivre, Renaud <renaud.de.chivre@intel.com>
Tested-by: Barthes, FabienX <fabienx.barthes@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
-rwxr-xr-x | tools/xmlGenerator/hostDomainGenerator.sh | 13 |
1 files changed, 13 insertions, 0 deletions
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 |