1<?xml version="1.0" encoding="UTF-8"?> 2 3<!-- Copyright (c) 2014, STMicroelectronics International N.V. --> 4<!-- All rights reserved. --> 5<!-- Copyright (c) 2020, Linaro Limited --> 6<!-- --> 7<!-- Redistribution and use in source and binary forms, with or without --> 8<!-- modification, are permitted provided that the following conditions are met: --> 9<!-- --> 10<!-- 1. Redistributions of source code must retain the above copyright notice, --> 11<!-- this list of conditions and the following disclaimer. --> 12<!-- --> 13<!-- 2. Redistributions in binary form must reproduce the above copyright notice, --> 14<!-- this list of conditions and the following disclaimer in the documentation --> 15<!-- and/or other materials provided with the distribution. --> 16<!-- --> 17<!-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" --> 18<!-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE --> 19<!-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE --> 20<!-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE --> 21<!-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR --> 22<!-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF --> 23<!-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS --> 24<!-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN --> 25<!-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) --> 26<!-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE --> 27<!-- POSSIBILITY OF SUCH DAMAGE. --> 28 29<xsl:stylesheet version="1.0" 30xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 31 32<xsl:output method="text"/> 33<xsl:strip-space elements="*"/> 34<xsl:param name="target"/> 35 36<xsl:template match="package"> 37<xsl:text> 38/* 39 * Copyright (c) 2014, STMicroelectronics International N.V. 40 * 41 * This program is free software; you can redistribute it and/or modify 42 * it under the terms of the GNU General Public License Version 2 as 43 * published by the Free Software Foundation. 44 * 45 * This program is distributed in the hope that it will be useful, 46 * but WITHOUT ANY WARRANTY; without even the implied warranty of 47 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 48 * GNU General Public License for more details. 49 * 50 * You should have received a copy of the GNU General Public License along 51 * with this program; if not, write to the Free Software Foundation, Inc., 52 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 53 */ 54 55#include "xml_datastorage_api.h" 56 57</xsl:text> 58<xsl:for-each select="initial-state/scenario"> 59/*<xsl:value-of select="substring(substring-after(./@name, '('), 0, 9)" />*/ 60static void xtest_tee_<xsl:value-of select="position()+30000" />(ADBG_Case_t *c) 61{ 62 declare_local_vars 63 64<xsl:for-each select="./preamble/call/operation"> 65 <xsl:apply-templates select="."></xsl:apply-templates> 66</xsl:for-each> 67<xsl:for-each select="./body/call/operation|./body/call/observations/operation"> 68 <xsl:apply-templates select="."></xsl:apply-templates> 69</xsl:for-each> 70<xsl:for-each select="./verification/call/operation"> 71 <xsl:apply-templates select="."></xsl:apply-templates> 72</xsl:for-each> 73<xsl:for-each select="./postamble/call/operation"> 74 <xsl:apply-templates select="."></xsl:apply-templates> 75</xsl:for-each> 76} 77</xsl:for-each> 78 79<xsl:for-each select="initial-state/scenario"> 80<xsl:variable name="position" select="position()+30000" /> 81ADBG_CASE_DEFINE(gp, <xsl:value-of select="$position" />, xtest_tee_<xsl:value-of select="$position" /><xsl:text>, "</xsl:text><xsl:value-of select="substring(substring-after(./@name, '('), 0, 9)" /><xsl:text>");</xsl:text> 82</xsl:for-each> 83</xsl:template> 84 85<xsl:template match="operation"> 86<xsl:choose> 87<!--Call an operation with ADBG_EXPECT() macro.--> 88<xsl:when test="(contains(./argument[last()]/parameter/@name, 'xpected') and not(contains(./@name, 'OpenSession')) and not(contains(./@name, 'InitializeContext')) and not(contains(./@name, 'Invoke_TruncateReadObjectData')) and not(contains(./@name, 'Invoke_TruncateReadObjectData')) and not(contains(./@name, 'Check_ObjectBufferAttribute')) and not(contains(./@name, 'Check_ObjectValueAttribute')))"> ADBG_EXPECT(c, <xsl:for-each select="./argument"><xsl:if test="position()=last()"><xsl:apply-templates select="value"></xsl:apply-templates></xsl:if></xsl:for-each>, <xsl:apply-templates select="./@name"></xsl:apply-templates><xsl:for-each select="./argument/value"><xsl:if test="position()>1 and not(position()=last())">, </xsl:if><xsl:if test="not(position()=last())"><xsl:apply-templates select="."></xsl:apply-templates></xsl:if> 89</xsl:for-each>)); 90</xsl:when> 91<xsl:otherwise> 92<xsl:text> </xsl:text><xsl:apply-templates select="./@name"></xsl:apply-templates><xsl:for-each select="./argument"><xsl:if test="position()>1">, </xsl:if> 93 <xsl:apply-templates select="./value"></xsl:apply-templates> 94</xsl:for-each>); 95</xsl:otherwise> 96</xsl:choose> 97 98</xsl:template> 99 100<xsl:template match="value"> 101<xsl:choose> 102<xsl:when test="(contains(./@name, 'UUID'))"><xsl:text>&</xsl:text><xsl:value-of select="./@name" /> 103</xsl:when> 104<xsl:when test="(contains(../type/@name, 'ALL_ATTRIBUTE_VALUES'))"><xsl:value-of select="./@name" /><xsl:text>, sizeof(</xsl:text><xsl:value-of select="./@name" /><xsl:text>)</xsl:text> 105</xsl:when> 106<xsl:when test="(../type/@name='ALL_TEE_NAMES' and ./@name='NULL')"><xsl:text>xtest_tee_name</xsl:text> 107</xsl:when> 108<xsl:when test="(../type/@name='ALL_TEE_OBJECT_HANDLES' and ./@name='NULL')"><xsl:text>OBJECT_HANDLE_NULL</xsl:text> 109</xsl:when> 110<xsl:when test="(../type/@name='ALL_TTA_STORED_OBJECT_ENUMERATORS' and ./@name='NULL')"><xsl:text>OBJECT_HANDLE_NULL</xsl:text> 111</xsl:when> 112<xsl:when test="(../type/@name='ALL_TTA_STORED_ATTRIBUTES' and ./@name='NONE')"><xsl:text>ATTRIBUTE_NONE</xsl:text> 113</xsl:when> 114<xsl:otherwise> 115<!--xsl:text>&</xsl:text--><xsl:value-of select="./@name" /> 116</xsl:otherwise> 117</xsl:choose> 118</xsl:template> 119 120<xsl:template match="parameter"> 121 <xsl:value-of select="./@name" /> 122</xsl:template> 123 124<xsl:template match="@name"> 125<xsl:choose> 126<xsl:when test=".='InitializeContext'"><xsl:text>XML_</xsl:text><xsl:value-of select="." /><xsl:text>(c, </xsl:text> 127</xsl:when> 128<xsl:when test=".='OpenSession'"><xsl:text>XML_</xsl:text><xsl:value-of select="." /><xsl:text>(c, </xsl:text> 129</xsl:when> 130<xsl:when test=".='SelectApp'"><xsl:text>TEEC_</xsl:text><xsl:value-of select="." /><xsl:text>(</xsl:text> 131</xsl:when> 132<xsl:when test=".='CloseSession'"><xsl:text>TEEC_</xsl:text><xsl:value-of select="." /><xsl:text>(</xsl:text> 133</xsl:when> 134<xsl:when test=".='FinalizeContext'"><xsl:text>TEEC_</xsl:text><xsl:value-of select="." /><xsl:text>(</xsl:text> 135</xsl:when> 136<xsl:when test=".='Check_GeneratedDHAttributes'"><xsl:value-of select="." /><xsl:text>(c</xsl:text> 137</xsl:when> 138<xsl:when test=".='Check_GeneratedRSAAttributes'"><xsl:value-of select="." /><xsl:text>(c</xsl:text> 139</xsl:when> 140<xsl:when test=".='SetUp_TEE'"><xsl:text>TEEC_SetUp_TEE(</xsl:text> </xsl:when> 141<xsl:when test=".='TearDown_TEE'"><xsl:text>TEEC_TearDown_TEE(</xsl:text> </xsl:when> 142<xsl:otherwise> 143<xsl:value-of select="." /><xsl:text>(c, </xsl:text> 144</xsl:otherwise> 145</xsl:choose> 146</xsl:template> 147 148</xsl:stylesheet> 149