Home | History | Annotate | Download | only in data
      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.
     18 TIMEZONE_DIR=${ANDROID_BUILD_TOP}/system/timezone
     19 DISTRO_TOOLS_DIR=${TIMEZONE_DIR}/distro/tools
     20 REFERENCE_DISTRO_FILES=${TIMEZONE_DIR}/output_data
     21 
     22 # Fail on error
     23 set -e
     24 
     25 # Test 1: A set of data newer than the system-image data from ${TIMEZONE_DIR}
     26 IANA_VERSION=2030a
     27 TEST_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
     33 mkdir -p ${TEST_DIR}/output_data/distro
     34 ${DISTRO_TOOLS_DIR}/create-distro.py \
     35     -iana_version ${IANA_VERSION} \
     36     -revision 1 \
     37     -tzdata ${TEST_DIR}/output_data/iana/tzdata \
     38     -icu ${TEST_DIR}/output_data/icu_overlay/icu_tzdata.dat \
     39     -tzlookup ${TEST_DIR}/output_data/android/tzlookup.xml \
     40     -output ${TEST_DIR}/output_data/distro
     41 
     42 # Test 2: A set of data older than the system-image data from ${TIMEZONE_DIR}
     43 IANA_VERSION=2016a
     44 TEST_DIR=test2
     45 
     46 # Create fake distro input files.
     47 ./transform-distro-files.sh ${REFERENCE_DISTRO_FILES} ${IANA_VERSION} ./${TEST_DIR}/output_data
     48 
     49 # Create the distro .zip
     50 mkdir -p ${TEST_DIR}/output_data/distro
     51 ${DISTRO_TOOLS_DIR}/create-distro.py \
     52     -iana_version ${IANA_VERSION} \
     53     -revision 1 \
     54     -tzdata ${TEST_DIR}/output_data/iana/tzdata \
     55     -icu ${TEST_DIR}/output_data/icu_overlay/icu_tzdata.dat \
     56     -tzlookup ${TEST_DIR}/output_data/android/tzlookup.xml \
     57     -output ${TEST_DIR}/output_data/distro
     58 
     59 
     60