Testing detection quality via shell script (Developers only)

Issue #9 resolved
Anonymous created an issue

I made some modifications to the shell script that allows developers to test timezone detection quality. This shell script is meant for developers and testers to quickly change Mac OS X system timezone and open detection page in Safari Browser.

Now it tests only one browser (Safari), because opening all browsers at once put Mac to hang. Now there come not error messages and printout is nicer. And it sets your original timezone back.



First get existing timezone to

switch it back after testing

origtimezone=systemsetup -gettimezone 2>&1

Get only the timezone name and strip possible warnings

origtimezone=echo $origtimezone | awk 'n=split($0,parts," ") {print parts[3]}'

List of timezones to test:

names=(America/Havana America/Goose_Bay America/St_Johns)
for name in ${names[@]}

Close Safari browser

killall -9 Safari &>/dev/null & # uncomment this if you know what you are doing

Set system timezone

systemsetup -settimezone $name >/dev/null 2>&1

Get system timezone

timezone=systemsetup -gettimezone 2>&1

Get only the timezone name and strip possible warnings

timezone=echo $timezone | awk 'n=split($0,parts," ") {print parts[3]}'

Check if setting system timezone succeeded

if [ "$timezone" = "$name" ]
echo '\033[1;31m ' $i/${#names[@]}: $name '\033[0m';
echo '\033[1;30m ' $i/${#names[@]}: $name (failed to set). Still using $timezone.'\030[0m';

Open Safari again

/Applications/Safari.app/Contents/MacOS/Safari /Users/timo/Documents/scripts/index2.html &>/dev/null &

Wait pressing Enter

read -p ""

let "i++"

Set back the original timezone

systemsetup -settimezone origtimezone >/dev/null 2>&1


Timo, the HeavyTester

Comments (1)

  1. Log in to comment