17b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller#!/usr/bin/env bash 27b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# 37b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Copyright (C) 2017 The Android Open Source Project 47b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# 57b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Licensed under the Apache License, Version 2.0 (the "License"); 67b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# you may not use this file except in compliance with the License. 77b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# You may obtain a copy of the License at 87b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# 97b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# http://www.apache.org/licenses/LICENSE-2.0 107b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# 117b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Unless required by applicable law or agreed to in writing, software 127b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# distributed under the License is distributed on an "AS IS" BASIS, 137b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 147b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# See the License for the specific language governing permissions and 157b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# limitations under the License. 167b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# 177b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Updates the test data files. 187b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil FullerTIMEZONE_DIR=${ANDROID_BUILD_TOP}/system/timezone 197b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil FullerDISTRO_TOOLS_DIR=${TIMEZONE_DIR}/distro/tools 207b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil FullerREFERENCE_DISTRO_FILES=${TIMEZONE_DIR}/output_data 217b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller 227b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Fail on error 237b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fullerset -e 247b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller 257b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Test 1: A set of data newer than the system-image data from ${TIMEZONE_DIR} 267b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil FullerIANA_VERSION=2030a 277b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil FullerTEST_DIR=test1 287b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller 297b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Create fake distro input files. 307b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller./transform-distro-files.sh ${REFERENCE_DISTRO_FILES} ${IANA_VERSION} ./${TEST_DIR}/output_data 317b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller 327b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Create the distro .zip 337b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fullermkdir -p ${TEST_DIR}/output_data/distro 347b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller${DISTRO_TOOLS_DIR}/create-distro.py \ 357b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -iana_version ${IANA_VERSION} \ 367b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -revision 1 \ 377b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -tzdata ${TEST_DIR}/output_data/iana/tzdata \ 387b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -icu ${TEST_DIR}/output_data/icu_overlay/icu_tzdata.dat \ 397b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -tzlookup ${TEST_DIR}/output_data/android/tzlookup.xml \ 407b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -output ${TEST_DIR}/output_data/distro 417b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller 427b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Test 2: A set of data older than the system-image data from ${TIMEZONE_DIR} 437b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil FullerIANA_VERSION=2016a 447b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil FullerTEST_DIR=test2 457b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller 467b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Create fake distro input files. 477b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller./transform-distro-files.sh ${REFERENCE_DISTRO_FILES} ${IANA_VERSION} ./${TEST_DIR}/output_data 487b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller 497b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller# Create the distro .zip 507b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fullermkdir -p ${TEST_DIR}/output_data/distro 517b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller${DISTRO_TOOLS_DIR}/create-distro.py \ 527b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -iana_version ${IANA_VERSION} \ 537b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -revision 1 \ 547b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -tzdata ${TEST_DIR}/output_data/iana/tzdata \ 557b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -icu ${TEST_DIR}/output_data/icu_overlay/icu_tzdata.dat \ 567b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -tzlookup ${TEST_DIR}/output_data/android/tzlookup.xml \ 577b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller -output ${TEST_DIR}/output_data/distro 587b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller 597b4b9e592d6c9010be93d018b8a7b594bf2c1ccfNeil Fuller 60