diff --git a/ameasure2/src/provisioner/MeasurementProvisioner.cpp b/ameasure2/src/provisioner/MeasurementProvisioner.cpp index dae789db7664138336dd853a6e077f5c2f85c3f1..784eb401f6a4d1f5e1f32a448840292a0e35b78e 100644 --- a/ameasure2/src/provisioner/MeasurementProvisioner.cpp +++ b/ameasure2/src/provisioner/MeasurementProvisioner.cpp @@ -41,7 +41,7 @@ void MeasurementProvisioner::prepareEnvironment ( const MeasurementProvisionerCo list < string > binariesDirectoryExpansion = MPUtils::shellExpand ( cfg.binariesDirectory ); if ( binariesDirectoryExpansion.size ( ) != 1 ) - throw::exception::CommonException ( "MeasurementProvisioner: binaries directory: \"" + cfg.binariesDirectory + "\"expansion failed" ); + throw::exception::CommonException ( "MeasurementProvisioner: binaries directory: \"" + cfg.binariesDirectory + "\" expansion failed" ); if ( chdir ( binariesDirectoryExpansion.begin ( )->c_str ( ) ) != 0 ) throw::exception::CommonException ( "MeasurementProvisioner: chdir to binaries directory: \"" + cfg.binariesDirectory + "\" failed" ); @@ -66,8 +66,13 @@ MPRPipelineResults MeasurementProvisioner::runPipeline ( const MPPipeline & pipe int outputTmpfileFd = open ( "/tmp", O_RDWR | O_TMPFILE, S_IRUSR | S_IWUSR ); int errorTmpfileFd = open ( "/tmp", O_RDWR | O_TMPFILE, S_IRUSR | S_IWUSR ); - if ( ( inputTmpfileFd == -1 ) || ( outputTmpfileFd == -1 ) || ( errorTmpfileFd == -1 ) ) + if ( ( inputTmpfileFd == -1 ) || ( outputTmpfileFd == -1 ) || ( errorTmpfileFd == -1 ) ) { + if ( inputTmpfileFd != -1 ) close ( inputTmpfileFd ); + if ( outputTmpfileFd != -1 ) close ( outputTmpfileFd ); + if ( errorTmpfileFd != -1 ) close ( errorTmpfileFd ); + throw::exception::CommonException ( "MeasurementProvisioner: Cannot make io tmp files" ); + } // store handles to stdin, stdout, stderr, we will need to restore them later int curStdinFd = dup ( 0 ); diff --git a/ameasure2/src/provisioner/MeasurementProvisionerConfigurationXml.cpp b/ameasure2/src/provisioner/MeasurementProvisionerConfigurationXml.cpp index 2a55961df1d88c74a3b1852c413e59021a1bfa45..f20577c8d58d9649dd96fef8c20938ab80ab6af8 100644 --- a/ameasure2/src/provisioner/MeasurementProvisionerConfigurationXml.cpp +++ b/ameasure2/src/provisioner/MeasurementProvisionerConfigurationXml.cpp @@ -101,6 +101,10 @@ void MeasurementProvisionerConfigurationXml::parseInputBatch ( MeasurementProvis if ( attrVal == "true" ) mpcib.forcedDependencyBatch = true; + else if ( attrVal == "false" ) + mpcib.forcedDependencyBatch = false; + else + throw::exception::CommonException ( "XML: MPCInputBatch malformed boolean attr: " + attrName ); FromXMLParserHelper::popToken ( iter, Token::TokenType::END_ATTRIBUTE, attrName ); } @@ -214,8 +218,12 @@ MPCPipelineCommand MeasurementProvisionerConfigurationXml::parsePipelineCommand FromXMLParserHelper::popToken ( iter, Token::TokenType::START_ATTRIBUTE, attrName ); string attrVal = FromXMLParserHelper::popTokenData ( iter, Token::TokenType::CHARACTER ); - if ( attrVal == "false" ) + if ( attrVal == "true" ) + mpcpc.measure = true; + else if ( attrVal == "false" ) mpcpc.measure = false; + else + throw::exception::CommonException ( "XML: MPCPipelineCommand malformed boolean attr: " + attrName ); FromXMLParserHelper::popToken ( iter, Token::TokenType::END_ATTRIBUTE, attrName ); } diff --git a/ameasure2/src/provisioner/MeasurementProvisionerInputData.cpp b/ameasure2/src/provisioner/MeasurementProvisionerInputData.cpp index d935eec9437cd8fcf6d8509ff7c99a1b4c00a428..639a6907566bb5625dbf2e2954b85aa74c1b24a8 100644 --- a/ameasure2/src/provisioner/MeasurementProvisionerInputData.cpp +++ b/ameasure2/src/provisioner/MeasurementProvisionerInputData.cpp @@ -218,7 +218,6 @@ void MPInputData::processSimpleBatchGeneratorData ( const MPCInputDatum & inputD } void MPInputData::processSimpleBatch ( const MPCInputBatch & inputBatch ) { - map < int, list < string > > distributedMPInputData; for ( const MPCInputDatum & inputDatum : inputBatch.batch ) { @@ -285,7 +284,8 @@ void MPInputData::processDependencyBatchGeneratorData ( const MPCInputDatum & in void MPInputData::processDependencyBatch ( const MPCInputBatch & inputBatch ) { // if the batch contains atleast one substitution, it is treated as dependency batch - // thus we process InputData in order of ids from 1 to N + // thus we process InputData in order of ids from 1 to N while feeding + // the already processed substitution maps into the batch being processed // distribute MPCInputData by their ids for processing in order map < int, list < MPCInputDatum > > distributedMPCInputData; diff --git a/ameasure2/src/provisioner/MeasurementProvisionerUtils.cpp b/ameasure2/src/provisioner/MeasurementProvisionerUtils.cpp index 4792ae68ac35488d1e156f1f36e704aab2049089..c222cf8614bb7f0ecdf43ab23a04545a3dd85b3c 100644 --- a/ameasure2/src/provisioner/MeasurementProvisionerUtils.cpp +++ b/ameasure2/src/provisioner/MeasurementProvisionerUtils.cpp @@ -44,7 +44,7 @@ std::string MPUtils::generateTmpfileFromCommand ( const std::string & command ) close ( tempfd ); dup ( stdoutfd ); - if ( status != 0 ) { + if ( WEXITSTATUS ( status ) != 0 ) { unlink ( temppath ); throw::exception::CommonException ( "MPUtils: system call failed" ); }