Skip to content
This repository
  • 7 commits
  • 4 files changed
  • 0 comments
  • 1 contributor
Apr 29, 2012
Alan Gutierrez Testing Travis CI.
Travis CI is timing out because my tests take longer than 10 minutes. The
reports stop on the transition tests, the process is killed before
`t/zones/olson/transitions.t` prints its results.

This runs only 10000 assertions in each of the transition tests, to get an idea
of how long it take Travis CI to run these tests.
b6b88a4
Alan Gutierrez Olson transition test now in Ruby for Travis CI.
Reimplemented the test that verifies the clock transition we've discovered in
the Olson files in Ruby. Travis CI doesn't like our bash program. I suspect that
it doesn't like programs that fork a bunch, and our bash test forks `date` 48266
times currently.

Tried to write the test in Perl, but Perl's `strftime` does not support `%::z`.

Ruby's does, but only in 1.9.3. The next few commits are going to explore using
`rvm` on the Node.js worker at Travis CI to install Ruby 1.9.3, for the sake of
this one test.
a725f49
Alan Gutierrez Install Ruby 1.9.3 using `apt-get` at Travis CI.
It's not enough to use the `rvm` YAML property. It's not recognized on a Node.js
worker. Wasn't able to use `rvm`, because there wasn't a ruby 1.9.3 already
installed in the `~/.rvm` directory of Travis CI's `vagrant` user. Couldn't
install one, because building Ruby 1.9.3 takes too long.

Installing a 3rd party Ruby 1.9.3 from
[Brightbox](http://blog.brightbox.co.uk/) using their Ubuntu Personal Package
Archive. Installing Ruby 1.9.3 using apt-get gets Ruby 1.9.3 installed fast
enough for a Travis CI test run.

We need Ruby 1.9.3 for the `%::z` format specifier. The `strftime` in 1.9.2 and
earlier does not support it.

I've created a bash program `bin/test` that will perform this apt-get install if
we're on Travis CI.

The clock transition tests are key tests of the integrity of this library. It
was well worth the effort to add those tests to continuous integration.
e6ded8b
Alan Gutierrez Move Ruby Olson clock transitions test into place.
The `bash` version of this program was moved to the `bin` directory two commits
back. The Ruby version is now being moved into its place.
0640808
Alan Gutierrez Travis CI output tidy.
There's an error message in the Travis CI output, saying that it can't link to
the `ruby` `man` page to the `ruby.1.9.3` `man` page, because it does not exist.

Deleted the link assignment.
189dce0
Alan Gutierrez Merge branch `travis-ci` into `master`. 1671063
Alan Gutierrez Merge branch `master` into `travis-ci`. 5329ce3
20 bin/test
... ... @@ -0,0 +1,20 @@
  1 +#!/bin/bash
  2 +
  3 +if [ "$TRAVIS" = "true" ]; then
  4 + (echo -e "\n\n\n" | sudo apt-add-repository ppa:brightbox/ruby-ng-experimental) >/dev/null 2>&1 && echo "brightbox added"
  5 + sudo apt-get -q update >/dev/null 2>&1 && echo "apt-get update"
  6 + sudo apt-get -q install ruby rubygems ruby-switch >/dev/null 2>&1 && echo "apt-get install ruby rubygems ruby-switch"
  7 + sudo apt-get -q install ruby1.9.3 >/dev/null 2>&1 && echo "apt-get install ruby1.9.3"
  8 + sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.3 400 \
  9 + --slave /usr/bin/ri ri /usr/bin/ri1.9.3 \
  10 + --slave /usr/bin/irb irb /usr/bin/irb1.9.3
  11 + sudo update-alternatives --set ruby /usr/bin/ruby1.9.3
  12 + PATH=/usr/local/gradle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
  13 + PATH=/usr/local/gradle/bin:/home/vagrant/.nvm/v0.6.15/bin:./node_modules/.bin:$PATH
  14 + PATH=/home/vagrant/builds/bigeasy/timezone/node_modules/.bin:./node_modules/.bin:$PATH
  15 + PATH=/home/vagrant/.nvm/v0.6.15/lib/node_modules/npm/bin/node-gyp-bin:$PATH
  16 + export PATH
  17 + ruby -v
  18 +fi
  19 +
  20 +proof t/*/*.t t/locale/*/*.t t/zones/*/*.t || exit 1
42 bin/transitions.t
... ... @@ -0,0 +1,42 @@
  1 +#!/bin/bash
  2 +
  3 +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  4 +IANA="$( cd "$DIR/../iana" && pwd )"
  5 +
  6 +count=0
  7 +while read line
  8 +do
  9 + array=($line)
  10 + utc=${array[2]}
  11 + if [ "${utc%%-*}" -lt 1902 ]; then continue; fi
  12 + let count=count+1
  13 +done < "$IANA/zones.txt"
  14 +
  15 +#echo "1..$(expr $count '*' 2)"
  16 +echo "1..10000"
  17 +
  18 +count=1
  19 +while read line
  20 +do
  21 + if [ $count -eq 10001 ]; then break; fi
  22 + array=($line)
  23 + utc=${array[2]/T/ }
  24 + if [ "${utc%%-*}" -lt 1902 ]; then continue; fi
  25 + # Date cannot do zone shifts with to the second accuracy.
  26 + before=$(TZ=":$IANA/zoneinfo/${array[0]}" date -d 'TZ="UTC" -1 minute '"$utc" +"%::z/%Z")
  27 + after=$(TZ=":$IANA/zoneinfo/${array[0]}" date -d 'TZ="UTC" +1 minute '"$utc" +"%::z/%Z")
  28 + if [ "$before" = "${array[3]}" ]
  29 + then
  30 + echo "ok ${count} # before ${array[0]} ${array[1]}"
  31 + else
  32 + echo "not ok ${count} ${array[0]} ${array[1]} ${array[2]} ${array[2]} != $before"
  33 + fi
  34 + let count=count+1
  35 + if [ "$after" = "${array[4]}" ]
  36 + then
  37 + echo "ok ${count} # after ${array[0]} ${array[1]}"
  38 + else
  39 + echo "not ok ${count} ${array[0]} ${array[1]} ${array[2]} ${array[4]} != $after"
  40 + fi
  41 + let count=count+1
  42 +done < "$IANA/zones.txt"
2  package.json
@@ -10,6 +10,6 @@
10 10 , "proof": ">=0.0.1" }
11 11 , "lib" : "lib"
12 12 , "main" : "./lib/timezone"
13   -, "scripts" : { "test": "proof t/*/*.t t/locale/*/*.t t/zones/*/*.t" }
  13 +, "scripts" : { "test": "bin/test" }
14 14 , "engines" : { "node": "> 0.4.0" }
15 15 }
76 t/zones/olson/transitions.t
... ... @@ -1,40 +1,44 @@
1   -#!/bin/bash
  1 +#!/usr/bin/env ruby
2 2
3   -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4   -IANA="$( cd "$DIR/../../../iana" && pwd )"
  3 +require "time"
  4 +require "date"
5 5
6   -count=0
7   -while read line
8   -do
9   - array=($line)
10   - utc=${array[2]}
11   - if [ "${utc%%-*}" -lt 1902 ]; then continue; fi
12   - let count=count+1
13   -done < "$IANA/zones.txt"
  6 +DIR = File.expand_path(File.dirname(__FILE__))
  7 +IANA = File.expand_path("#{DIR}/../../../iana")
14 8
15   -echo "1..$(expr $count '*' 2)"
  9 +ENV["TZ"] = "UTC"
  10 +counter = 0
  11 +File.open("#{IANA}/zones.txt", "r") do |infile|
  12 + while (line = infile.gets)
  13 + name, wallclock, posix, before, after = line.split(/\s/)
  14 + time = Time.parse posix
  15 + if time.year > 1902
  16 + counter = counter + 2
  17 + end
  18 + end
  19 +end
16 20
17   -count=1
18   -while read line
19   -do
20   - array=($line)
21   - utc=$(echo ${array[2]} | tr T ' ')
22   - if [ "${utc%%-*}" -lt 1902 ]; then continue; fi
23   - # Date cannot do zone shifts with to the second accuracy.
24   - before=$(TZ=":$IANA/zoneinfo/${array[0]}" date -d 'TZ="UTC" -1 minute '"$utc" +"%::z/%Z")
25   - after=$(TZ=":$IANA/zoneinfo/${array[0]}" date -d 'TZ="UTC" +1 minute '"$utc" +"%::z/%Z")
26   - if [ "$before" = "${array[3]}" ]
27   - then
28   - echo "ok ${count} # before ${array[0]} ${array[1]}"
29   - else
30   - echo "not ok ${count} ${array[0]} ${array[1]} ${array[2]} ${array[2]} != $before"
31   - fi
32   - let count=count+1
33   - if [ "$after" = "${array[4]}" ]
34   - then
35   - echo "ok ${count} # after ${array[0]} ${array[1]}"
36   - else
37   - echo "not ok ${count} ${array[0]} ${array[1]} ${array[2]} ${array[4]} != $after"
38   - fi
39   - let count=count+1
40   -done < "$IANA/zones.txt"
  21 +puts "1..#{counter}"
  22 +
  23 +counter = 1
  24 +File.open("#{IANA}/zones.txt", "r") do |infile|
  25 + while (line = infile.gets)
  26 + name, wallclock, posix, before, after = line.split(/\s/)
  27 + ENV["TZ"] = "UTC"
  28 + time = Time.parse posix
  29 + if time.year > 1902
  30 + ENV["TZ"] = ":#{IANA}/zoneinfo/#{name}"
  31 + time = Time.at(time.to_i)
  32 + offsetAbbrevation = (time + 60).strftime("%::z/%Z")
  33 + ok = after == offsetAbbrevation ? "ok" : "not ok"
  34 + puts "#{ok} #{counter} after #{name} #{wallclock} #{posix} #{after} #{offsetAbbrevation}"
  35 + counter = counter + 1
  36 + offsetAbbrevation = (time - 60).strftime("%::z/%Z")
  37 + ok = (before == offsetAbbrevation ? "ok" : "not ok")
  38 + puts "#{ok} #{counter} before #{name} #{wallclock} #{posix} #{before} #{offsetAbbrevation}"
  39 + counter = counter + 1
  40 + end
  41 + end
  42 +end
  43 +
  44 +# vim: ft=ruby :

No commit comments for this range

Something went wrong with that request. Please try again.