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 19TZVERSION_TOOLS_DIR=${TIMEZONE_DIR}/input_tools/version 20REFERENCE_DATA_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 data input files. 30./transform-data-files.sh ${REFERENCE_DATA_FILES} ${IANA_VERSION} ./${TEST_DIR}/output_data 31 32# Create the tz version file. 33mkdir -p ${TEST_DIR}/output_data/version 34${TZVERSION_TOOLS_DIR}/create-tz_version.py \ 35 -iana_version ${IANA_VERSION} \ 36 -revision 1 \ 37 -output_version_file ${TEST_DIR}/output_data/version/tz_version 38 39# Test 2 was about out-dated APK installation. Knowledge about these tests might be hardcoded 40# somewhere, so test3 is left as test3, not test2. Renaming might break something w/o obvious 41# benefits. 42 43# Test 3: A corrupted set of data like test 1, but with a truncated ICU 44# overlay file. This test data set exists because it is (currently) a good way 45# to trigger a boot loop which enables easy watchdog and recovery testing. 46IANA_VERSION=2030a 47TEST_DIR=test3 48 49# Create fake data input files. 50./transform-data-files.sh ${REFERENCE_DATA_FILES} ${IANA_VERSION} ./${TEST_DIR}/output_data 51 52# Corrupt icu_tzdata.dat by truncating it 53truncate --size 27766 ${TEST_DIR}/output_data/icu_overlay/icu_tzdata.dat 54 55# Create tz version file. 56mkdir -p ${TEST_DIR}/output_data/version 57${TZVERSION_TOOLS_DIR}/create-tz_version.py \ 58 -iana_version ${IANA_VERSION} \ 59 -revision 1 \ 60 -output_version_file ${TEST_DIR}/output_data/version/tz_version 61