xref: /illumos-gate/usr/src/test/tz-tests/tests/tzname_17947.ksh (revision d35c3d74c35b26ba5829798f51a44ce4d80d091b)
1#!/usr/bin/ksh
2#
3# This file and its contents are supplied under the terms of the
4# Common Development and Distribution License ("CDDL"), version 1.0.
5# You may only use this file in accordance with the terms of version
6# 1.0 of the CDDL.
7#
8# A full copy of the text of the CDDL should have accompanied this
9# source.  A copy of the CDDL is also available via the Internet at
10# http://www.illumos.org/license/CDDL.
11#
12
13#
14# Copyright 2025 Oxide Computer Company
15#
16
17#
18# This test serves as a basic regression test for #17947 where we were
19# incorrectly determining the value of tzname[] for various POSIX-style
20# timezones due to how we had updated the data and incorrect assumptions made
21# around indexes that were thrown off with the addition of LMT.
22#
23
24unalias -a
25set -o pipefail
26export LANG=C.UTF-8
27
28tz_dir=$(dirname $0)
29tz_n32="$tz_dir/tznames.32"
30tz_n64="$tz_dir/tznames.64"
31tz_exit=0
32
33#
34# When there is no DST style time zone, then the following empty string is used.
35#
36tz_none="   "
37
38test_one()
39{
40	if ! $tz_n32 "$1" "$2" "$3"; then
41		tz_exit=1
42	fi
43
44	if ! $tz_n64 "$1" "$2" "$3"; then
45		tz_exit=1
46	fi
47}
48
49test_one UTC UTC "$tz_none"
50test_one UTC0UTC UTC UTC
51test_one GMT0GMT GMT GMT
52test_one FOO0BAR FOO BAR
53test_one America/New_York EST EDT
54test_one CET0 CET "$tz_none"
55test_one CET0CET CET CET
56test_one CET0CEST CET CEST
57test_one Asia/Tokyo JST JDT
58test_one Europe/Rome CET CEST
59test_one Australia/Brisbane AEST AEDT
60
61if (( tz_exit == 0 )); then
62	printf "All tests passed successfully!\n"
63fi
64
65exit $tz_exit
66