From ab2861993d3079e003ad36068dc0355a737d0f82 Mon Sep 17 00:00:00 2001 From: Michal Kolar Date: Wed, 11 Dec 2024 13:21:08 +0000 Subject: [PATCH] Add tests/Sanity/trivial_case Sync test cases with Fedora Rawhide Update origin tests/sanity to new fmf standard and fix LOCALE issue Add .fmf/version to enable tmt Add default plan plans/main.fmf --- .fmf/version | 1 + plans/main.fmf | 5 + .../trivial_case/date.golden} | 0 .../trivial_case/datetimes} | 0 tests/Sanity/trivial_case/main.fmf | 10 + tests/Sanity/trivial_case/test.sh | 41 ++ .../trivial_case/zones} | 0 tests/inventory | 3 - tests/sanity/Makefile | 73 --- tests/sanity/PURPOSE | 1 - tests/sanity/runtest.sh | 28 - tests/sanity/tzdata-test.sh | 50 -- tests/tests.yml | 13 - tests/tzdata-checker/Makefile | 63 ++ tests/tzdata-checker/PURPOSE | 11 + tests/tzdata-checker/main.fmf | 34 + tests/tzdata-checker/no-beakerlib-wrapper.sh | 72 +++ tests/tzdata-checker/runtest.sh | 103 +++ tests/tzdata-checker/zones.min | 592 ++++++++++++++++++ 19 files changed, 932 insertions(+), 168 deletions(-) create mode 100644 .fmf/version create mode 100644 plans/main.fmf rename tests/{sanity/expected.results => Sanity/trivial_case/date.golden} (100%) rename tests/{sanity/dates.txt => Sanity/trivial_case/datetimes} (100%) create mode 100644 tests/Sanity/trivial_case/main.fmf create mode 100755 tests/Sanity/trivial_case/test.sh rename tests/{sanity/timezones.txt => Sanity/trivial_case/zones} (100%) delete mode 100755 tests/inventory delete mode 100644 tests/sanity/Makefile delete mode 100644 tests/sanity/PURPOSE delete mode 100644 tests/sanity/runtest.sh delete mode 100755 tests/sanity/tzdata-test.sh delete mode 100644 tests/tests.yml create mode 100644 tests/tzdata-checker/Makefile create mode 100644 tests/tzdata-checker/PURPOSE create mode 100644 tests/tzdata-checker/main.fmf create mode 100644 tests/tzdata-checker/no-beakerlib-wrapper.sh create mode 100755 tests/tzdata-checker/runtest.sh create mode 100644 tests/tzdata-checker/zones.min diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plans/main.fmf b/plans/main.fmf new file mode 100644 index 0000000..ec17042 --- /dev/null +++ b/plans/main.fmf @@ -0,0 +1,5 @@ +summary: Main Plan +discover: + how: fmf +execute: + how: tmt diff --git a/tests/sanity/expected.results b/tests/Sanity/trivial_case/date.golden similarity index 100% rename from tests/sanity/expected.results rename to tests/Sanity/trivial_case/date.golden diff --git a/tests/sanity/dates.txt b/tests/Sanity/trivial_case/datetimes similarity index 100% rename from tests/sanity/dates.txt rename to tests/Sanity/trivial_case/datetimes diff --git a/tests/Sanity/trivial_case/main.fmf b/tests/Sanity/trivial_case/main.fmf new file mode 100644 index 0000000..09494ed --- /dev/null +++ b/tests/Sanity/trivial_case/main.fmf @@ -0,0 +1,10 @@ +summary: tzdata testing by trivial case +component: +- tzdata +test: ./test.sh +tier: 1 +framework: beakerlib +require+: +- tzdata +- coreutils +duration: 5m diff --git a/tests/Sanity/trivial_case/test.sh b/tests/Sanity/trivial_case/test.sh new file mode 100755 index 0000000..c23dfc9 --- /dev/null +++ b/tests/Sanity/trivial_case/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="tzdata" +REQUIRES="$PACKAGE coreutils glibc" +export LC_TIME=C + +rlJournalStart + rlPhaseStartSetup + rlShowRunningKernel + rlAssertRpm --all + rlRun "TmpDir=\$(mktemp -d)" + rlRun "cp zones datetimes date.golden $TmpDir" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest "run test" + while read timezone; do + rlLogInfo "timezone: $timezone" + while read datetime; do + echo -n "$timezone $datetime -> " >>date.log + rlRun "TZ=$timezone date -d \"$datetime\" >>date.log" + done date.diff"; then + rlFail "Differences observed"; + rlRun "rlFileSubmit ./date.diff date.diff" + fi + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/sanity/timezones.txt b/tests/Sanity/trivial_case/zones similarity index 100% rename from tests/sanity/timezones.txt rename to tests/Sanity/trivial_case/zones diff --git a/tests/inventory b/tests/inventory deleted file mode 100755 index 93eafb6..0000000 --- a/tests/inventory +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -export TEST_DOCKER_EXTRA_ARGS="-v /dev:/dev --privileged" -exec merge-standard-inventory "$@" diff --git a/tests/sanity/Makefile b/tests/sanity/Makefile deleted file mode 100644 index 5181434..0000000 --- a/tests/sanity/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/tzdata/sanity -# Description: Basic sanity test -# Author: John Poelstra -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2006 Red Hat, Inc. -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# The toplevel namespace within which the test lives. -TOPLEVEL_NAMESPACE=/CoreOS - -# The name of the package under test: -PACKAGE_NAME=tzdata - -# The path of the test below the package: -RELATIVE_PATH=sanity - -# Version of the Test. Used with make tag. -export TESTVERSION=1.4 - -# The combined namespace of the test. -#export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) -export TEST=/CoreOS/tzdata/sanity -.PHONY: all install download clean - -BUILT_FILES= -FILES=$(METADATA) tzdata-test.sh runtest.sh PURPOSE timezones.txt expected.results dates.txt - -run: $(FILES) build - ./runtest.sh - -build: $(BUILT_FILES) - chmod a+x ./runtest.sh - chmod a+x ./tzdata-test.sh - -clean: - rm -f *~ *.rpm $(BUILT_FILES) - -# Include Common Makefile -include /usr/share/rhts/lib/rhts-make.include - -# Generate the testinfo.desc here: -$(METADATA): Makefile - @touch $(METADATA) - @echo "Owner: Karel Volny " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Description: Basic sanity test for the tzdata package">> $(METADATA) - @echo "TestTime: 1m" >> $(METADATA) - @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) - @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) -# You may need other fields here; see the documentation - rhts-lint $(METADATA) diff --git a/tests/sanity/PURPOSE b/tests/sanity/PURPOSE deleted file mode 100644 index c87ebfd..0000000 --- a/tests/sanity/PURPOSE +++ /dev/null @@ -1 +0,0 @@ -This is a simple regression test of tzdata which tests the installed version against expected values. diff --git a/tests/sanity/runtest.sh b/tests/sanity/runtest.sh deleted file mode 100644 index 995b04f..0000000 --- a/tests/sanity/runtest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/tzdata/sanity -# Description: Basic sanity test -# Author: John Poelstra -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2006 Red Hat, Inc. -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -rhts-run-simple-test $TEST ./tzdata-test.sh diff --git a/tests/sanity/tzdata-test.sh b/tests/sanity/tzdata-test.sh deleted file mode 100755 index 4d08a61..0000000 --- a/tests/sanity/tzdata-test.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# tzdata-test.sh of /CoreOS/tzdata/sanity -# Description: Basic sanity test -# Original author: Ulrich Drepper -# Modified and broken into separate files by: John Poelstra -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2006 Red Hat, Inc. -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -ZONES="timezones.txt" -DATES="dates.txt" -EXPECTED="expected.results" -GENERATED="$(mktemp)" - -cat $ZONES | while read timezone; do - echo "timezone == $timezone" | tee -a $OUTPUTFILE - cat $DATES | while read datetime; do - echo "datetime == $datetime" | tee -a $OUTPUTFILE - printf "%s %s -> %s\n" "$timezone" "$datetime" "$(env TZ=$timezone date -d \ - "$datetime")" | tee -a $OUTPUTFILE | tee -a $GENERATED - done -done - -if diff -u $EXPECTED $GENERATED -then - echo "Test PASSED" | tee -a $OUTPUTFILE -else - echo "Test FAILED" | tee -a $OUTPUTFILE - 2>&1 | tee -a $OUTPUTFILE - exit 1 -fi diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 224460f..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# Tests for classic and container -- hosts: localhost - roles: - - role: standard-test-beakerlib - tags: - - classic - - container - - atomic - tests: - - sanity - required_packages: - - which diff --git a/tests/tzdata-checker/Makefile b/tests/tzdata-checker/Makefile new file mode 100644 index 0000000..9e297af --- /dev/null +++ b/tests/tzdata-checker/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/tzdata/Sanity/tzdata-checker +# Description: Testing tzdata by comparing base pkg with upstream +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2018 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/tzdata/Sanity/tzdata-checker +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE zones.min no-beakerlib-wrapper.sh + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Michal Kolar " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Testing tzdata by comparing base pkg with upstream" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 1h" >> $(METADATA) + @echo "RunFor: tzdata" >> $(METADATA) + @echo "Requires: tzdata coreutils diffutils findutils gawk gcc glibc-common grep gzip make patch sed tar wget file" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/tzdata-checker/PURPOSE b/tests/tzdata-checker/PURPOSE new file mode 100644 index 0000000..70ca68b --- /dev/null +++ b/tests/tzdata-checker/PURPOSE @@ -0,0 +1,11 @@ +PURPOSE of /CoreOS/tzdata/Sanity/tzdata-checker +Description: Testing tzdata by comparing base pkg with upstream +Author: Michal Kolar + +Executing can be modified by these variables: + * NO_BEAKERLIB -- if this variable is set to "1" tescase use wrapper for rl* commands instead of beakerlib. + It could be useful on systems without installed beaker framework. + +Example: + NO_BEAKERLIB=1 ./runtest.sh + diff --git a/tests/tzdata-checker/main.fmf b/tests/tzdata-checker/main.fmf new file mode 100644 index 0000000..f9ed60f --- /dev/null +++ b/tests/tzdata-checker/main.fmf @@ -0,0 +1,34 @@ +summary: Testing tzdata by comparing base pkg with upstream +description: |+ + Executing can be modified by these variables: + * NO_BEAKERLIB -- if this variable is set to "1" tescase use wrapper for rl* commands instead of beakerlib. + It could be useful on systems without installed beaker framework. + + Example: + NO_BEAKERLIB=1 ./runtest.sh + +contact: +- Michal Kolar +component: +- tzdata +test: ./runtest.sh +framework: beakerlib +recommend: +- tzdata +- coreutils +- diffutils +- findutils +- gawk +- gcc +- glibc-common +- grep +- gzip +- make +- patch +- sed +- tar +- wget +- file +duration: 1h +extra-summary: /CoreOS/tzdata/Sanity/tzdata-checker +extra-task: /CoreOS/tzdata/Sanity/tzdata-checker diff --git a/tests/tzdata-checker/no-beakerlib-wrapper.sh b/tests/tzdata-checker/no-beakerlib-wrapper.sh new file mode 100644 index 0000000..b73e207 --- /dev/null +++ b/tests/tzdata-checker/no-beakerlib-wrapper.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +failCounter=0 +passCounter=0 + +rlJournalStart() +{ + timeStart=`date +%s.%N` +} + +rlShowRunningKernel() +{ + printf ":: [ %s ] :: [ \e[36mLOG\e[0m ] :: Kernel version: '%s'\n" `date +%s.%N` `uname -r` +} + +rlAssertRpm() +{ + if rpm -q $1; then + ((passCounter++)) + printf ":: [ %s ] :: [ \e[32mPASS\e[0m ] :: Checking for the presence of %s rpm\n" `date +%s.%N` "$1" + printf ":: [ %s ] :: [ \e[36mLOG\e[0m ] :: %s\n" `date +%s.%N` `rpm -q $1` + else + ((failCounter++)) + printf ":: [ %s ] :: [ \e[31;1mFAIL\e[0m ] :: Checking for the presence of %s rpm\n" `date +%s.%N` "$1" + fi +} + +rlRun() +{ + eval $1 + retVal=$? + if [ "$retVal" != "0" ]; then + ((failCounter++)) + printf ":: [ %s ] :: [ \e[31;1mFAIL\e[0m ] :: Command '%s'\n" `date +%s.%N` "$1" + else + ((passCounter++)) + printf ":: [ %s ] :: [ \e[32mPASS\e[0m ] :: Command '%s'\n" `date +%s.%N` "$1" + fi + return $retVal +} + +rlLogInfo() +{ + printf ":: [ %s ] :: [ \e[33mINFO\e[0m ] :: %s\n" `date +%s.%N` "$1" +} + +rlJournalPrintText() +{ + timeEnd=`date +%s.%N` +} + +rlJournalEnd() +{ + printf '\n\n\n::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n' + printf ':: TEST PROTOCOL\n' + printf '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n' + printf ':: Duration: %s s\n' `bc <<< "$timeEnd - $timeStart"` + printf ':: Assertions: %i good, %i bad\n:: RESULT: ' $passCounter $failCounter + if [ "$failCounter" != "0" ]; then + printf '\e[31;1mFAIL\e[0m\n' + else + printf '\e[32mPASS\e[0m\n' + fi +} + +rlFileSubmit(){ return 0; } + +rlPhaseEnd(){ return 0; } + +rlPhaseStartCleanup(){ return 0; } + +rlPhaseStartSetup(){ return 0; } diff --git a/tests/tzdata-checker/runtest.sh b/tests/tzdata-checker/runtest.sh new file mode 100755 index 0000000..af24c09 --- /dev/null +++ b/tests/tzdata-checker/runtest.sh @@ -0,0 +1,103 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/tzdata/Sanity/tzdata-checker +# Description: Testing tzdata by comparing base pkg with upstream +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2018 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +if [ "$NO_BEAKERLIB" == "1" ]; then + . ./no-beakerlib-wrapper.sh || exit 1 +else + # Include Beaker environment + . /usr/share/beakerlib/beakerlib.sh || exit 1 +fi + +PACKAGE="tzdata" +TZDATA_URL="https://data.iana.org/time-zones/releases" +TZDATA_VERSION="${TZDATA_VERSION:-$(rpm -q --qf '%{VERSION}\n' $PACKAGE | head -1)}" +if rlIsFedora; then + DATAFORM="${DATAFORM:-vanguard}" +else + DATAFORM="${DATAFORM:-rearguard}" +fi +YEARS=20 # used for shrink zdump output to reasonable future + +hiyear=$((`date +%Y` + $YEARS)) +export LC_ALL=C + +rlJournalStart + rlPhaseStartSetup + rlShowRunningKernel + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" + rlRun "cp zones.min $TmpDir" + rlRun "pushd $TmpDir" + rlRun "mkdir badzones" + rlPhaseEnd + + rlPhaseStartSetup "Build upstream tzdata" # source: https://data.iana.org/time-zones/tz-link.html + rlRun "wget --no-check-certificate ${TZDATA_URL}/tzcode${TZDATA_VERSION}.tar.gz" + rlRun "wget --no-check-certificate ${TZDATA_URL}/tzdata${TZDATA_VERSION}.tar.gz" + rlRun "tar -xzf tzcode*" + rlRun "tar -xzf tzdata*" + + rlRun "make DATAFORM=$DATAFORM TOPDIR=./tzdir install" + rlRun "find tzdir/usr/share/zoneinfo -type f | xargs file | grep 'timezone data' | grep -o -E 'zoneinfo/[^:]+' | sed 's|zoneinfo/||' | sort -u >zones.ref" + rlRun "find /usr/share/zoneinfo -type f | xargs file | grep 'timezone data' | grep -o -E 'zoneinfo/[^:]+' | sed 's|zoneinfo/||' | sort -u >zones.cur" + rlRun "comm -12 zones.ref zones.cur >zones.int" # intersection of ref zones with cur zones + rlRun "sort -u zones.min >zones-sorted.min" + rlRun "comm -13 zones.int zones-sorted.min >zones.mis" + rlRun "if [ -s ./zones.mis ]; then cat ./zones.mis; false; fi" + rlLogInfo "Number of time zones: `cat zones.int | wc -l`" + rlPhaseEnd + + rlPhaseStartSetup "Test zdump" + for zone in `cat zones.int`; do + if rlIsRHEL "<8"; then # glibc's zdump is out of sync for '-v option' + rlRun "./zdump -v -c 1970,$hiyear $zone >ref" + rlRun "./zdump -v -c 1970,$hiyear /usr/share/zoneinfo/$zone >cur" + sed -i 's|^/usr/share/zoneinfo/||' cur + else + rlRun "./zdump -V -c 1970,$hiyear $zone >ref" + rlRun "zdump -V -c 1970,$hiyear $zone >cur" + fi + + # normalize zdump outputs + sed -i 's/\ UTC/\ UT/g' ref cur + + if ! rlRun "diff -q ref cur"; then + filezone=`echo $zone | tr '/' '_'` + cp ref ./badzones/${filezone}.ref + cp cur ./badzones/${filezone}.cur + fi + done + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "tar -czf badzones.tar.gz ./badzones" + rlRun "rlFileSubmit badzones.tar.gz" + rlRun "popd" + rlRun "rm -r $TmpDir" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/tzdata-checker/zones.min b/tests/tzdata-checker/zones.min new file mode 100644 index 0000000..92353a3 --- /dev/null +++ b/tests/tzdata-checker/zones.min @@ -0,0 +1,592 @@ +Africa/Abidjan +Africa/Accra +Africa/Addis_Ababa +Africa/Algiers +Africa/Asmara +Africa/Asmera +Africa/Bamako +Africa/Bangui +Africa/Banjul +Africa/Bissau +Africa/Blantyre +Africa/Brazzaville +Africa/Bujumbura +Africa/Cairo +Africa/Casablanca +Africa/Ceuta +Africa/Conakry +Africa/Dakar +Africa/Dar_es_Salaam +Africa/Djibouti +Africa/Douala +Africa/El_Aaiun +Africa/Freetown +Africa/Gaborone +Africa/Harare +Africa/Johannesburg +Africa/Juba +Africa/Kampala +Africa/Khartoum +Africa/Kigali +Africa/Kinshasa +Africa/Lagos +Africa/Libreville +Africa/Lome +Africa/Luanda +Africa/Lubumbashi +Africa/Lusaka +Africa/Malabo +Africa/Maputo +Africa/Maseru +Africa/Mbabane +Africa/Mogadishu +Africa/Monrovia +Africa/Nairobi +Africa/Ndjamena +Africa/Niamey +Africa/Nouakchott +Africa/Ouagadougou +Africa/Porto-Novo +Africa/Sao_Tome +Africa/Timbuktu +Africa/Tripoli +Africa/Tunis +Africa/Windhoek +America/Adak +America/Anchorage +America/Anguilla +America/Antigua +America/Araguaina +America/Argentina/Buenos_Aires +America/Argentina/Catamarca +America/Argentina/ComodRivadavia +America/Argentina/Cordoba +America/Argentina/Jujuy +America/Argentina/La_Rioja +America/Argentina/Mendoza +America/Argentina/Rio_Gallegos +America/Argentina/Salta +America/Argentina/San_Juan +America/Argentina/San_Luis +America/Argentina/Tucuman +America/Argentina/Ushuaia +America/Aruba +America/Asuncion +America/Atikokan +America/Atka +America/Bahia +America/Bahia_Banderas +America/Barbados +America/Belem +America/Belize +America/Blanc-Sablon +America/Boa_Vista +America/Bogota +America/Boise +America/Buenos_Aires +America/Cambridge_Bay +America/Campo_Grande +America/Cancun +America/Caracas +America/Catamarca +America/Cayenne +America/Cayman +America/Chicago +America/Chihuahua +America/Coral_Harbour +America/Cordoba +America/Costa_Rica +America/Creston +America/Cuiaba +America/Curacao +America/Danmarkshavn +America/Dawson +America/Dawson_Creek +America/Denver +America/Detroit +America/Dominica +America/Edmonton +America/Eirunepe +America/El_Salvador +America/Ensenada +America/Fort_Nelson +America/Fort_Wayne +America/Fortaleza +America/Glace_Bay +America/Godthab +America/Goose_Bay +America/Grand_Turk +America/Grenada +America/Guadeloupe +America/Guatemala +America/Guayaquil +America/Guyana +America/Halifax +America/Havana +America/Hermosillo +America/Indiana/Indianapolis +America/Indiana/Knox +America/Indiana/Marengo +America/Indiana/Petersburg +America/Indiana/Tell_City +America/Indiana/Vevay +America/Indiana/Vincennes +America/Indiana/Winamac +America/Indianapolis +America/Inuvik +America/Iqaluit +America/Jamaica +America/Jujuy +America/Juneau +America/Kentucky/Louisville +America/Kentucky/Monticello +America/Knox_IN +America/Kralendijk +America/La_Paz +America/Lima +America/Los_Angeles +America/Louisville +America/Lower_Princes +America/Maceio +America/Managua +America/Manaus +America/Marigot +America/Martinique +America/Matamoros +America/Mazatlan +America/Mendoza +America/Menominee +America/Merida +America/Metlakatla +America/Mexico_City +America/Miquelon +America/Moncton +America/Monterrey +America/Montevideo +America/Montreal +America/Montserrat +America/Nassau +America/New_York +America/Nipigon +America/Nome +America/Noronha +America/North_Dakota/Beulah +America/North_Dakota/Center +America/North_Dakota/New_Salem +America/Ojinaga +America/Panama +America/Pangnirtung +America/Paramaribo +America/Phoenix +America/Port-au-Prince +America/Port_of_Spain +America/Porto_Acre +America/Porto_Velho +America/Puerto_Rico +America/Punta_Arenas +America/Rainy_River +America/Rankin_Inlet +America/Recife +America/Regina +America/Resolute +America/Rio_Branco +America/Rosario +America/Santa_Isabel +America/Santarem +America/Santiago +America/Santo_Domingo +America/Sao_Paulo +America/Scoresbysund +America/Shiprock +America/Sitka +America/St_Barthelemy +America/St_Johns +America/St_Kitts +America/St_Lucia +America/St_Thomas +America/St_Vincent +America/Swift_Current +America/Tegucigalpa +America/Thule +America/Thunder_Bay +America/Tijuana +America/Toronto +America/Tortola +America/Vancouver +America/Virgin +America/Whitehorse +America/Winnipeg +America/Yakutat +America/Yellowknife +Antarctica/Casey +Antarctica/Davis +Antarctica/DumontDUrville +Antarctica/Macquarie +Antarctica/Mawson +Antarctica/McMurdo +Antarctica/Palmer +Antarctica/Rothera +Antarctica/South_Pole +Antarctica/Syowa +Antarctica/Troll +Antarctica/Vostok +Arctic/Longyearbyen +Asia/Aden +Asia/Almaty +Asia/Amman +Asia/Anadyr +Asia/Aqtau +Asia/Aqtobe +Asia/Ashgabat +Asia/Ashkhabad +Asia/Atyrau +Asia/Baghdad +Asia/Bahrain +Asia/Baku +Asia/Bangkok +Asia/Barnaul +Asia/Beirut +Asia/Bishkek +Asia/Brunei +Asia/Calcutta +Asia/Chita +Asia/Choibalsan +Asia/Chongqing +Asia/Chungking +Asia/Colombo +Asia/Dacca +Asia/Damascus +Asia/Dhaka +Asia/Dili +Asia/Dubai +Asia/Dushanbe +Asia/Famagusta +Asia/Gaza +Asia/Harbin +Asia/Hebron +Asia/Ho_Chi_Minh +Asia/Hong_Kong +Asia/Hovd +Asia/Irkutsk +Asia/Istanbul +Asia/Jakarta +Asia/Jayapura +Asia/Jerusalem +Asia/Kabul +Asia/Kamchatka +Asia/Karachi +Asia/Kashgar +Asia/Kathmandu +Asia/Katmandu +Asia/Khandyga +Asia/Kolkata +Asia/Krasnoyarsk +Asia/Kuala_Lumpur +Asia/Kuching +Asia/Kuwait +Asia/Macao +Asia/Macau +Asia/Magadan +Asia/Makassar +Asia/Manila +Asia/Muscat +Asia/Nicosia +Asia/Novokuznetsk +Asia/Novosibirsk +Asia/Omsk +Asia/Oral +Asia/Phnom_Penh +Asia/Pontianak +Asia/Pyongyang +Asia/Qatar +Asia/Qostanay +Asia/Qyzylorda +Asia/Rangoon +Asia/Riyadh +Asia/Saigon +Asia/Sakhalin +Asia/Samarkand +Asia/Seoul +Asia/Shanghai +Asia/Singapore +Asia/Srednekolymsk +Asia/Taipei +Asia/Tashkent +Asia/Tbilisi +Asia/Tehran +Asia/Tel_Aviv +Asia/Thimbu +Asia/Thimphu +Asia/Tokyo +Asia/Tomsk +Asia/Ujung_Pandang +Asia/Ulaanbaatar +Asia/Ulan_Bator +Asia/Urumqi +Asia/Ust-Nera +Asia/Vientiane +Asia/Vladivostok +Asia/Yakutsk +Asia/Yangon +Asia/Yekaterinburg +Asia/Yerevan +Atlantic/Azores +Atlantic/Bermuda +Atlantic/Canary +Atlantic/Cape_Verde +Atlantic/Faeroe +Atlantic/Faroe +Atlantic/Jan_Mayen +Atlantic/Madeira +Atlantic/Reykjavik +Atlantic/South_Georgia +Atlantic/St_Helena +Atlantic/Stanley +Australia/ACT +Australia/Adelaide +Australia/Brisbane +Australia/Broken_Hill +Australia/Canberra +Australia/Currie +Australia/Darwin +Australia/Eucla +Australia/Hobart +Australia/LHI +Australia/Lindeman +Australia/Lord_Howe +Australia/Melbourne +Australia/NSW +Australia/North +Australia/Perth +Australia/Queensland +Australia/South +Australia/Sydney +Australia/Tasmania +Australia/Victoria +Australia/West +Australia/Yancowinna +Brazil/Acre +Brazil/DeNoronha +Brazil/East +Brazil/West +CET +CST6CDT +Canada/Atlantic +Canada/Central +Canada/Eastern +Canada/Mountain +Canada/Newfoundland +Canada/Pacific +Canada/Saskatchewan +Canada/Yukon +Chile/Continental +Chile/EasterIsland +Cuba +EET +EST +EST5EDT +Egypt +Eire +Etc/GMT +Etc/GMT+0 +Etc/GMT+1 +Etc/GMT+10 +Etc/GMT+11 +Etc/GMT+12 +Etc/GMT+2 +Etc/GMT+3 +Etc/GMT+4 +Etc/GMT+5 +Etc/GMT+6 +Etc/GMT+7 +Etc/GMT+8 +Etc/GMT+9 +Etc/GMT-0 +Etc/GMT-1 +Etc/GMT-10 +Etc/GMT-11 +Etc/GMT-12 +Etc/GMT-13 +Etc/GMT-14 +Etc/GMT-2 +Etc/GMT-3 +Etc/GMT-4 +Etc/GMT-5 +Etc/GMT-6 +Etc/GMT-7 +Etc/GMT-8 +Etc/GMT-9 +Etc/GMT0 +Etc/Greenwich +Etc/UCT +Etc/UTC +Etc/Universal +Etc/Zulu +Europe/Amsterdam +Europe/Andorra +Europe/Astrakhan +Europe/Athens +Europe/Belfast +Europe/Belgrade +Europe/Berlin +Europe/Bratislava +Europe/Brussels +Europe/Bucharest +Europe/Budapest +Europe/Busingen +Europe/Chisinau +Europe/Copenhagen +Europe/Dublin +Europe/Gibraltar +Europe/Guernsey +Europe/Helsinki +Europe/Isle_of_Man +Europe/Istanbul +Europe/Jersey +Europe/Kaliningrad +Europe/Kiev +Europe/Kirov +Europe/Lisbon +Europe/Ljubljana +Europe/London +Europe/Luxembourg +Europe/Madrid +Europe/Malta +Europe/Mariehamn +Europe/Minsk +Europe/Monaco +Europe/Moscow +Europe/Nicosia +Europe/Oslo +Europe/Paris +Europe/Podgorica +Europe/Prague +Europe/Riga +Europe/Rome +Europe/Samara +Europe/San_Marino +Europe/Sarajevo +Europe/Saratov +Europe/Simferopol +Europe/Skopje +Europe/Sofia +Europe/Stockholm +Europe/Tallinn +Europe/Tirane +Europe/Tiraspol +Europe/Ulyanovsk +Europe/Uzhgorod +Europe/Vaduz +Europe/Vatican +Europe/Vienna +Europe/Vilnius +Europe/Volgograd +Europe/Warsaw +Europe/Zagreb +Europe/Zaporozhye +Europe/Zurich +GB +GB-Eire +GMT +GMT+0 +GMT-0 +GMT0 +Greenwich +HST +Hongkong +Iceland +Indian/Antananarivo +Indian/Chagos +Indian/Christmas +Indian/Cocos +Indian/Comoro +Indian/Kerguelen +Indian/Mahe +Indian/Maldives +Indian/Mauritius +Indian/Mayotte +Indian/Reunion +Iran +Israel +Jamaica +Japan +Kwajalein +Libya +MET +MST +MST7MDT +Mexico/BajaNorte +Mexico/BajaSur +Mexico/General +NZ +NZ-CHAT +Navajo +PRC +PST8PDT +Pacific/Apia +Pacific/Auckland +Pacific/Bougainville +Pacific/Chatham +Pacific/Chuuk +Pacific/Easter +Pacific/Efate +Pacific/Enderbury +Pacific/Fakaofo +Pacific/Fiji +Pacific/Funafuti +Pacific/Galapagos +Pacific/Gambier +Pacific/Guadalcanal +Pacific/Guam +Pacific/Honolulu +Pacific/Johnston +Pacific/Kiritimati +Pacific/Kosrae +Pacific/Kwajalein +Pacific/Majuro +Pacific/Marquesas +Pacific/Midway +Pacific/Nauru +Pacific/Niue +Pacific/Norfolk +Pacific/Noumea +Pacific/Pago_Pago +Pacific/Palau +Pacific/Pitcairn +Pacific/Pohnpei +Pacific/Ponape +Pacific/Port_Moresby +Pacific/Rarotonga +Pacific/Saipan +Pacific/Samoa +Pacific/Tahiti +Pacific/Tarawa +Pacific/Tongatapu +Pacific/Truk +Pacific/Wake +Pacific/Wallis +Pacific/Yap +Poland +Portugal +ROC +ROK +Singapore +Turkey +UCT +US/Alaska +US/Aleutian +US/Arizona +US/Central +US/East-Indiana +US/Eastern +US/Hawaii +US/Indiana-Starke +US/Michigan +US/Mountain +US/Pacific +US/Samoa +UTC +Universal +W-SU +WET +Zulu