1#!/usr/bin/env bash 2# 3# Copyright (C) 2017 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16# 17# Updates the test data files. 18TIMEZONE_DIR=${ANDROID_BUILD_TOP}/system/timezone 19DISTRO_TOOLS_DIR=${TIMEZONE_DIR}/distro/tools 20REFERENCE_DISTRO_FILES=${TIMEZONE_DIR}/output_data 21 22# Fail on error 23set -e 24 25# Test 1: A set of data newer than the system-image data from ${TIMEZONE_DIR} 26IANA_VERSION=2030a 27TEST_DIR=test1 28 29# Create fake distro input files. 30./transform-distro-files.sh ${REFERENCE_DISTRO_FILES} ${IANA_VERSION} ./${TEST_DIR}/output_data 31 32# Create the distro .zip 33mkdir -p ${TEST_DIR}/output_data/distro 34mkdir -p ${TEST_DIR}/output_data/version 35${DISTRO_TOOLS_DIR}/create-distro.py \ 36 -iana_version ${IANA_VERSION} \ 37 -revision 1 \ 38 -tzdata ${TEST_DIR}/output_data/iana/tzdata \ 39 -icu ${TEST_DIR}/output_data/icu_overlay/icu_tzdata.dat \ 40 -tzlookup ${TEST_DIR}/output_data/android/tzlookup.xml \ 41 -output_distro_dir ${TEST_DIR}/output_data/distro \ 42 -output_version_file ${TEST_DIR}/output_data/version/tz_version 43 44# Test 2: A set of data older than the system-image data from ${TIMEZONE_DIR} 45IANA_VERSION=2016a 46TEST_DIR=test2 47 48# Create fake distro input files. 49./transform-distro-files.sh ${REFERENCE_DISTRO_FILES} ${IANA_VERSION} ./${TEST_DIR}/output_data 50 51# Create the distro .zip 52mkdir -p ${TEST_DIR}/output_data/distro 53mkdir -p ${TEST_DIR}/output_data/version 54${DISTRO_TOOLS_DIR}/create-distro.py \ 55 -iana_version ${IANA_VERSION} \ 56 -revision 1 \ 57 -tzdata ${TEST_DIR}/output_data/iana/tzdata \ 58 -icu ${TEST_DIR}/output_data/icu_overlay/icu_tzdata.dat \ 59 -tzlookup ${TEST_DIR}/output_data/android/tzlookup.xml \ 60 -output_distro_dir ${TEST_DIR}/output_data/distro \ 61 -output_version_file ${TEST_DIR}/output_data/version/tz_version 62 63 64