From 397cfb624defe0b4fcb22351536478379fdc711a Mon Sep 17 00:00:00 2001 From: Mattijs Korpershoek Date: Fri, 18 Apr 2014 08:52:05 +0200 Subject: Updated hostDomainGenerator.sh schema validation BZ: 188323 In order to validate xml files, we need the corresponding schemas to be next to the xml files. Those are put by the script in /tmp. This patch add the copying of the schema files to /tmp. I also adds an optional command line argument to disable/enable validation. This is useful for platform specific enabling/disabling validation. It can be used by calling hostDomainGenerator.sh --validate. Change-Id: I7da65f230e5abf5b1d18c5cd6cf11b67dae5ed76 Signed-off-by: Mattijs Korpershoek --- tools/xmlGenerator/hostDomainGenerator.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/xmlGenerator/hostDomainGenerator.sh b/tools/xmlGenerator/hostDomainGenerator.sh index 1af42ba..4cfce4d 100755 --- a/tools/xmlGenerator/hostDomainGenerator.sh +++ b/tools/xmlGenerator/hostDomainGenerator.sh @@ -52,6 +52,11 @@ exec 5> >(sed "s/^/($$) Warning: /" >&2) exec 2> >(sed "s/^/($$) Error: /" >&2) # Get script arguments +validationEnabled="false" +if [ "$1" = "--validate" ]; then + validationEnabled="true" + shift +fi PFWconfigurationFilePath="$1"; shift CriterionFilePath="$1"; shift xmlDomainFilePath="$1"; shift @@ -76,7 +81,8 @@ TPSocket=5003 PFWSocket=5000 PFWStartTimeout=60 -tmpFile=$(mktemp) +tmpDir=$(mktemp -d) +tmpFile=$(mktemp --tmpdir="$tmpDir") # [Workaround] # The build system does not preserve execution right in external prebuild @@ -112,6 +118,12 @@ clean_up () { echo "Cleaning $tmpFile ..." rm "$tmpFile" || true + if [ "$validationEnabled" = "true" ]; then + echo "Cleaning $tmpDir/Schemas ..." + rm -r "$tmpDir/Schemas" || true + rmdir "$tmpDir" || true + fi + echo "Cleaning status: $status ..." return $status } @@ -201,7 +213,7 @@ launchTestPlatform () { $TPSendCommand setFailureOnMissingSubsystem false $TPSendCommand setFailureOnFailedSettingsLoad false - $TPSendCommand setValidateSchemasOnStart false + $TPSendCommand setValidateSchemasOnStart $validationEnabled echo "Asking test-platform (port $TPSocket) to start a new PFW instance (listening on port $PFWSocket) ..." $TPSendCommand start @@ -264,6 +276,15 @@ deleteEscapedNewLines () { sed -r ':a;/\\$/{N;s/\\\n//;ba}' } +copySchemaFiles() { + cp -r "$HostRoot"/etc/parameter-framework/Schemas "$tmpDir/Schemas" +} + +# Copy the schema files needed for validation +if [ "$validationEnabled" = "true" ]; then + copySchemaFiles +fi + # The PFW looks for a libremote-processor.so library, not a libremote-processor_host.so linkLibrary libremote-processor_host.so libremote-processor.so -- cgit v1.1