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_internal_api.h" 56 57</xsl:text> 58 59<xsl:for-each select="initial-state/scenario"> 60/*<xsl:value-of select="substring(substring-after(./@name, '('), 0, 9)" />*/ 61static void xtest_tee_<xsl:value-of select="position()+20000" />(ADBG_Case_t *c) 62{ 63<xsl:for-each select="./preamble/call/operation"> 64 <xsl:apply-templates select="."></xsl:apply-templates> 65</xsl:for-each> 66<xsl:for-each select="./body/call/operation"> 67 <xsl:apply-templates select="."></xsl:apply-templates> 68</xsl:for-each> 69<xsl:for-each select="./postamble/call/operation"> 70 <xsl:apply-templates select="."></xsl:apply-templates> 71</xsl:for-each> 72} 73</xsl:for-each> 74<xsl:for-each select="initial-state/scenario"> 75<xsl:variable name="position" select="position()+20000" /> 76ADBG_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> 77</xsl:for-each> 78</xsl:template> 79 80<xsl:template match="operation"> 81<xsl:choose> 82<!--Call an operation with ADBG_EXPECT() macro.--> 83<xsl:when test="(contains(./argument[last()]/parameter/@name, 'xpected') and not(contains(./@name, 'OpenSession')) and not(contains(./@name, 'InitializeContext')))"> 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> 84 </xsl:for-each>)); 85</xsl:when> 86<xsl:when test="(contains(./@name, 'Invoke_ProcessInvokeTAOpenSession'))"> 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> 87 </xsl:for-each>)); 88</xsl:when> 89<xsl:otherwise> 90<xsl:text> </xsl:text><xsl:apply-templates select="./@name"></xsl:apply-templates><xsl:for-each select="./argument"><xsl:if test="position()>1">, </xsl:if> 91 <xsl:apply-templates select="./value"></xsl:apply-templates> 92 </xsl:for-each>); 93</xsl:otherwise> 94</xsl:choose> 95 96</xsl:template> 97 98<xsl:template match="value"> 99<xsl:choose> 100<xsl:when test="((contains(./@name, 'UUID')) and not(contains(./@name, 'VALUE_PREDEFINED_UUID')) and not(contains(./@name, 'CMD_TEE_GetPropertyAsUUID_withoutEnum')))"><xsl:text>&</xsl:text><xsl:value-of select="./@name" /> 101</xsl:when> 102<xsl:when test="(../type/@name='ALL_TEE_NAMES' and ./@name='NULL')"><xsl:text>xtest_tee_name</xsl:text> 103</xsl:when> 104<xsl:otherwise> 105<!--xsl:text>&</xsl:text--><xsl:value-of select="./@name" /> 106</xsl:otherwise> 107</xsl:choose> 108</xsl:template> 109 110<xsl:template match="parameter"> 111 <xsl:value-of select="./@name" /> 112</xsl:template> 113 114<xsl:template match="@name"> 115<xsl:choose> 116<xsl:when test=".='RequestCancellation'"><xsl:value-of select="." /><xsl:text>(</xsl:text> 117</xsl:when> 118<xsl:when test=".='InitializeContext'"><xsl:text>XML_</xsl:text><xsl:value-of select="." /><xsl:text>(c, </xsl:text> 119</xsl:when> 120<xsl:when test=".='OpenSession'"><xsl:text>XML_</xsl:text><xsl:value-of select="." /><xsl:text>(c, </xsl:text> 121</xsl:when> 122<xsl:when test=".='SelectApp'"><xsl:text>TEEC_</xsl:text><xsl:value-of select="." /><xsl:text>(</xsl:text> 123</xsl:when> 124<xsl:when test=".='CloseSession'"><xsl:text>TEEC_</xsl:text><xsl:value-of select="." /><xsl:text>(</xsl:text> 125</xsl:when> 126<xsl:when test=".='FinalizeContext'"><xsl:text>TEEC_</xsl:text><xsl:value-of select="." /><xsl:text>(</xsl:text> 127</xsl:when> 128<xsl:when test=".='createThread'"><xsl:text>TEEC_</xsl:text><xsl:value-of select="." /><xsl:text>(</xsl:text> 129</xsl:when> 130<xsl:when test=".='PARAM_TYPES'"><xsl:text>OPERATION_TEEC_</xsl:text><xsl:value-of select="." /><xsl:text>(</xsl:text> 131</xsl:when> 132<xsl:when test=".='SetUp_TEE'"><xsl:text>TEEC_SetUp_TEE(</xsl:text> </xsl:when> 133<xsl:when test=".='TearDown_TEE'"><xsl:text>TEEC_TearDown_TEE(</xsl:text> </xsl:when> 134<xsl:otherwise> 135<xsl:value-of select="." /><xsl:text>(c, </xsl:text> 136</xsl:otherwise> 137</xsl:choose> 138</xsl:template> 139 140</xsl:stylesheet> 141