196bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin#!/bin/bash 296bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin 396bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# 496bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# Copyright (C) 2012 The Android Open Source Project 596bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# 696bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# Licensed under the Apache License, Version 2.0 (the "License"); 796bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# you may not use this file except in compliance with the License. 896bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# You may obtain a copy of the License at 996bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# 1096bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# http://www.apache.org/licenses/LICENSE-2.0 1196bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# 1296bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# Unless required by applicable law or agreed to in writing, software 1396bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# distributed under the License is distributed on an "AS IS" BASIS, 1496bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1596bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# See the License for the specific language governing permissions and 1696bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# limitations under the License. 1796bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# 1896bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin 1996bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# 2096bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# Sanity check the XML parser by making sure it's generating the same data 2196bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# as the original parsed data. 2296bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin# 2396bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin 240888556e14c90a5dcf43ae31159418bc60a97128Eino-Ville Talvalathisdir=$(cd "$(dirname "$0")"; pwd) 2596bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin 260334aa09f264001d9e875fe3706b7b6b68bb8d01Igor Murashkin$thisdir/metadata-check-dependencies || exit 1 270334aa09f264001d9e875fe3706b7b6b68bb8d01Igor Murashkin 280888556e14c90a5dcf43ae31159418bc60a97128Eino-Ville Talvalatmp_out=$(mktemp -t tmp.XXXXXXXXXX) 290888556e14c90a5dcf43ae31159418bc60a97128Eino-Ville Talvalatmp_tidy1=$(mktemp -t tmp.XXXXXXXXXX) 300888556e14c90a5dcf43ae31159418bc60a97128Eino-Ville Talvalatmp_tidy2=$(mktemp -t tmp.XXXXXXXXXX) 3196bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin 32480986832a29121f7a16e49f30e5c5f7501ef56cIgor Murashkinpython $thisdir/metadata_parser_xml.py $thisdir/metadata_properties.xml $thisdir/metadata_template.mako $tmp_out || exit 1 3396bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkintidy -indent -xml -quiet $thisdir/metadata_properties.xml > $tmp_tidy1 3496bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkintidy -indent -xml -quiet $tmp_out > $tmp_tidy2 3596bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin 3696bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkindiff $tmp_tidy1 $tmp_tidy2 3796bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkinexit_code=$? 3896bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkinrm $tmp_out $tmp_tidy1 $tmp_tidy2 3996bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin 4096bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkinif [[ $exit_code -ne 0 ]] 4196bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkinthen 4296bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin echo "ERROR: Files differ, please check parser logic" 1>&2 4396bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkinelse 4496bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin echo "SUCCESS: Files are the same!" 1>&2 4596bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkinfi 4696bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkin 4796bd019289c47433e1b3522500bb166a4662e0f5Igor Murashkinexit $exit_code 48