]> arthur.barton.de Git - bup.git/commitdiff
test-ls.sh: eliminate timezone dependencies; test dates in two timezones.
authorRob Browning <rlb@defaultvalue.org>
Thu, 6 Feb 2014 00:34:32 +0000 (18:34 -0600)
committerRob Browning <rlb@defaultvalue.org>
Thu, 6 Feb 2014 00:36:26 +0000 (18:36 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
t/test-ls.sh

index 506f30818e781b4ec776d8364ff56879f0a18f2b..b786bedbb052e1ef7f2c94760919daa253bd483f 100755 (executable)
@@ -11,24 +11,26 @@ export GIT_DIR="$tmpdir/bup"
 
 bup() { "$top/bup" "$@"; }
 
+export TZ=UTC
+
 WVPASS bup init
 WVPASS cd "$tmpdir"
 
 WVPASS mkdir src
-WVPASS touch -t 191111111111 src/.dotfile
+WVPASS touch -t 196907202018 src/.dotfile
 WVPASS date > src/file
 WVPASS bup random 1k > src/file
-WVPASS touch -t 191111111111 src/file
+WVPASS touch -t 196907202018 src/file
 (WVPASS cd src; WVPASS ln -s file symlink) || exit $?
 WVPASS mkfifo src/fifo
-WVPASS touch -t 191111111111 src/fifo
+WVPASS touch -t 196907202018 src/fifo
 WVPASS "$top"/t/mksock src/socket
-WVPASS touch -t 191111111111 src/socket
-WVPASS touch -t 191111111111 src/executable
+WVPASS touch -t 196907202018 src/socket
+WVPASS touch -t 196907202018 src/executable
 WVPASS chmod u+x src/executable
-WVPASS touch -t 191111111111 src/executable
-WVPASS touch -t 191111111111 src
-WVPASS touch -t 191111111111 .
+WVPASS touch -t 196907202018 src/executable
+WVPASS touch -t 196907202018 src
+WVPASS touch -t 196907202018 .
 WVPASS chmod -R u=rwX,g-rwx,o-rwx .
 WVPASS bup index src
 WVPASS bup save -n src src
@@ -94,31 +96,31 @@ symlink@"
 WVSTART "ls (long)"
 
 WVPASSEQ "$(WVPASS bup ls -l / | tr -s ' ' ' ')" \
-"d--------- ?/? - 1969-12-31 18:00 src"
+"d--------- ?/? - 1970-01-01 00:00 src"
 
 WVPASSEQ "$(WVPASS bup ls -lA / | tr -s ' ' ' ')" \
-"d--------- ?/? - 1969-12-31 18:00 .commit
-d--------- ?/? - 1969-12-31 18:00 .tag
-d--------- ?/? - 1969-12-31 18:00 src"
+"d--------- ?/? - 1970-01-01 00:00 .commit
+d--------- ?/? - 1970-01-01 00:00 .tag
+d--------- ?/? - 1970-01-01 00:00 src"
 
 WVPASSEQ "$(WVPASS bup ls -lAF / | tr -s ' ' ' ')" \
-"d--------- ?/? - 1969-12-31 18:00 .commit/
-d--------- ?/? - 1969-12-31 18:00 .tag/
-d--------- ?/? - 1969-12-31 18:00 src/"
+"d--------- ?/? - 1970-01-01 00:00 .commit/
+d--------- ?/? - 1970-01-01 00:00 .tag/
+d--------- ?/? - 1970-01-01 00:00 src/"
 
 WVPASSEQ "$(WVPASS bup ls -la / | tr -s ' ' ' ')" \
-"d--------- ?/? - 1969-12-31 18:00 .
-d--------- ?/? - 1969-12-31 18:00 ..
-d--------- ?/? - 1969-12-31 18:00 .commit
-d--------- ?/? - 1969-12-31 18:00 .tag
-d--------- ?/? - 1969-12-31 18:00 src"
+"d--------- ?/? - 1970-01-01 00:00 .
+d--------- ?/? - 1970-01-01 00:00 ..
+d--------- ?/? - 1970-01-01 00:00 .commit
+d--------- ?/? - 1970-01-01 00:00 .tag
+d--------- ?/? - 1970-01-01 00:00 src"
 
 WVPASSEQ "$(WVPASS bup ls -laF / | tr -s ' ' ' ')" \
-"d--------- ?/? - 1969-12-31 18:00 ./
-d--------- ?/? - 1969-12-31 18:00 ../
-d--------- ?/? - 1969-12-31 18:00 .commit/
-d--------- ?/? - 1969-12-31 18:00 .tag/
-d--------- ?/? - 1969-12-31 18:00 src/"
+"d--------- ?/? - 1970-01-01 00:00 ./
+d--------- ?/? - 1970-01-01 00:00 ../
+d--------- ?/? - 1970-01-01 00:00 .commit/
+d--------- ?/? - 1970-01-01 00:00 .tag/
+d--------- ?/? - 1970-01-01 00:00 src/"
 
 symlink_size="$(python -c "import os; print os.lstat('src/symlink').st_size")"
 symlink_date="$(bup ls -l src/latest"$tmpdir"/src | grep symlink)"
@@ -130,49 +132,49 @@ user="$(id -un)" || exit $?
 group="$(id -gn)" || exit $?
 
 WVPASSEQ "$(bup ls -l src/latest"$tmpdir"/src | tr -s ' ' ' ')" \
-"-rwx------ $user/$group - 1911-11-11 11:11 executable
-prw------- $user/$group - 1911-11-11 11:11 fifo
--rw------- $user/$group 1024 1911-11-11 11:11 file
-srwx------ $user/$group - 1911-11-11 11:11 socket
+"-rwx------ $user/$group - 1969-07-20 20:18 executable
+prw------- $user/$group - 1969-07-20 20:18 fifo
+-rw------- $user/$group 1024 1969-07-20 20:18 file
+srwx------ $user/$group - 1969-07-20 20:18 socket
 lrwxrwxrwx $user/$group $symlink_size $symlink_date symlink -> file"
 
 WVPASSEQ "$(bup ls -la src/latest"$tmpdir"/src | tr -s ' ' ' ')" \
-"drwx------ $user/$group - 1911-11-11 11:11 .
-drwx------ $user/$group - 1911-11-11 11:11 ..
--rw------- $user/$group - 1911-11-11 11:11 .dotfile
--rwx------ $user/$group - 1911-11-11 11:11 executable
-prw------- $user/$group - 1911-11-11 11:11 fifo
--rw------- $user/$group 1024 1911-11-11 11:11 file
-srwx------ $user/$group - 1911-11-11 11:11 socket
+"drwx------ $user/$group - 1969-07-20 20:18 .
+drwx------ $user/$group - 1969-07-20 20:18 ..
+-rw------- $user/$group - 1969-07-20 20:18 .dotfile
+-rwx------ $user/$group - 1969-07-20 20:18 executable
+prw------- $user/$group - 1969-07-20 20:18 fifo
+-rw------- $user/$group 1024 1969-07-20 20:18 file
+srwx------ $user/$group - 1969-07-20 20:18 socket
 lrwxrwxrwx $user/$group $symlink_size $symlink_date symlink -> file"
 
 WVPASSEQ "$(bup ls -lA src/latest"$tmpdir"/src | tr -s ' ' ' ')" \
-"-rw------- $user/$group - 1911-11-11 11:11 .dotfile
--rwx------ $user/$group - 1911-11-11 11:11 executable
-prw------- $user/$group - 1911-11-11 11:11 fifo
--rw------- $user/$group 1024 1911-11-11 11:11 file
-srwx------ $user/$group - 1911-11-11 11:11 socket
+"-rw------- $user/$group - 1969-07-20 20:18 .dotfile
+-rwx------ $user/$group - 1969-07-20 20:18 executable
+prw------- $user/$group - 1969-07-20 20:18 fifo
+-rw------- $user/$group 1024 1969-07-20 20:18 file
+srwx------ $user/$group - 1969-07-20 20:18 socket
 lrwxrwxrwx $user/$group $symlink_size $symlink_date symlink -> file"
 
 WVPASSEQ "$(bup ls -lF src/latest"$tmpdir"/src | tr -s ' ' ' ')" \
-"-rwx------ $user/$group - 1911-11-11 11:11 executable*
-prw------- $user/$group - 1911-11-11 11:11 fifo|
--rw------- $user/$group 1024 1911-11-11 11:11 file
-srwx------ $user/$group - 1911-11-11 11:11 socket=
+"-rwx------ $user/$group - 1969-07-20 20:18 executable*
+prw------- $user/$group - 1969-07-20 20:18 fifo|
+-rw------- $user/$group 1024 1969-07-20 20:18 file
+srwx------ $user/$group - 1969-07-20 20:18 socket=
 lrwxrwxrwx $user/$group $symlink_size $symlink_date symlink@ -> file"
 
 WVPASSEQ "$(bup ls -l --file-type src/latest"$tmpdir"/src | tr -s ' ' ' ')" \
-"-rwx------ $user/$group - 1911-11-11 11:11 executable
-prw------- $user/$group - 1911-11-11 11:11 fifo|
--rw------- $user/$group 1024 1911-11-11 11:11 file
-srwx------ $user/$group - 1911-11-11 11:11 socket=
+"-rwx------ $user/$group - 1969-07-20 20:18 executable
+prw------- $user/$group - 1969-07-20 20:18 fifo|
+-rw------- $user/$group 1024 1969-07-20 20:18 file
+srwx------ $user/$group - 1969-07-20 20:18 socket=
 lrwxrwxrwx $user/$group $symlink_size $symlink_date symlink@ -> file"
 
 WVPASSEQ "$(bup ls -ln src/latest"$tmpdir"/src | tr -s ' ' ' ')" \
-"-rwx------ $uid/$gid - 1911-11-11 11:11 executable
-prw------- $uid/$gid - 1911-11-11 11:11 fifo
--rw------- $uid/$gid 1024 1911-11-11 11:11 file
-srwx------ $uid/$gid - 1911-11-11 11:11 socket
+"-rwx------ $uid/$gid - 1969-07-20 20:18 executable
+prw------- $uid/$gid - 1969-07-20 20:18 fifo
+-rw------- $uid/$gid 1024 1969-07-20 20:18 file
+srwx------ $uid/$gid - 1969-07-20 20:18 socket
 lrwxrwxrwx $uid/$gid $symlink_size $symlink_date symlink -> file"
 
 WVSTART "ls (backup set - long)"
@@ -180,4 +182,17 @@ WVPASSEQ "$(bup ls -l src | cut -d' ' -f 1-2)" \
 "l--------- ?/?
 l--------- ?/?"
 
+WVSTART "ls (dates TZ != UTC)"
+export TZ=US/Central
+symlink_date_central="$(bup ls -l src/latest"$tmpdir"/src | grep symlink)"
+symlink_date_central="$(echo "$symlink_date_central" \
+  | perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $2')"
+WVPASSEQ "$(bup ls -ln src/latest"$tmpdir"/src | tr -s ' ' ' ')" \
+"-rwx------ $uid/$gid - 1969-07-20 15:18 executable
+prw------- $uid/$gid - 1969-07-20 15:18 fifo
+-rw------- $uid/$gid 1024 1969-07-20 15:18 file
+srwx------ $uid/$gid - 1969-07-20 15:18 socket
+lrwxrwxrwx $uid/$gid $symlink_size $symlink_date_central symlink -> file"
+unset TZ
+
 WVPASS rm -rf "$tmpdir"