Skip to content

Commit 293cdf9

Browse files
committed
Rearrange data files for tests
1 parent 3a0915b commit 293cdf9

4 files changed

Lines changed: 70 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ cdfdump.html
66
tmp/
77
javadocs/
88
.*.swp
9-
data/*.cdf
9+
data/local/*.cdf

data/CDFLeapSeconds.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
; Source: <http://maia.usno.navy.mil/ser7/tai-utc.dat>
2+
; Updated: 20120401
3+
; Leap Seconds Table - used by CDF
4+
; Update it when a leap second(s) is added.
5+
; Comment lines starts with ";" at column 1.
6+
; Year Month Day Leap Seconds Drift
7+
1960 1 1 1.4178180 37300.0 0.001296
8+
1961 1 1 1.4228180 37300.0 0.001296
9+
1961 8 1 1.3728180 37300.0 0.001296
10+
1962 1 1 1.8458580 37665.0 0.0011232
11+
1963 11 1 1.9458580 37665.0 0.0011232
12+
1964 1 1 3.2401300 38761.0 0.001296
13+
1964 4 1 3.3401300 38761.0 0.001296
14+
1964 9 1 3.4401300 38761.0 0.001296
15+
1965 1 1 3.5401300 38761.0 0.001296
16+
1965 3 1 3.6401300 38761.0 0.001296
17+
1965 7 1 3.7401300 38761.0 0.001296
18+
1965 9 1 3.8401300 38761.0 0.001296
19+
1966 1 1 4.3131700 39126.0 0.002592
20+
1968 2 1 4.2131700 39126.0 0.002592
21+
1972 1 1 10.0 0.0 0.0
22+
1972 7 1 11.0 0.0 0.0
23+
1973 1 1 12.0 0.0 0.0
24+
1974 1 1 13.0 0.0 0.0
25+
1975 1 1 14.0 0.0 0.0
26+
1976 1 1 15.0 0.0 0.0
27+
1977 1 1 16.0 0.0 0.0
28+
1978 1 1 17.0 0.0 0.0
29+
1979 1 1 18.0 0.0 0.0
30+
1980 1 1 19.0 0.0 0.0
31+
1981 7 1 20.0 0.0 0.0
32+
1982 7 1 21.0 0.0 0.0
33+
1983 7 1 22.0 0.0 0.0
34+
1985 7 1 23.0 0.0 0.0
35+
1988 1 1 24.0 0.0 0.0
36+
1990 1 1 25.0 0.0 0.0
37+
1991 1 1 26.0 0.0 0.0
38+
1992 7 1 27.0 0.0 0.0
39+
1993 7 1 28.0 0.0 0.0
40+
1994 7 1 29.0 0.0 0.0
41+
1996 1 1 30.0 0.0 0.0
42+
1997 7 1 31.0 0.0 0.0
43+
1999 1 1 32.0 0.0 0.0
44+
2006 1 1 33.0 0.0 0.0
45+
2009 1 1 34.0 0.0 0.0
46+
2012 7 1 35.0 0.0 0.0

data/test_badleap.cdf

29.5 KB
Binary file not shown.

makefile

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ WWW_FILES = $(JARFILE) javadocs index.html cdflist.html cdfdump.html
1111
WWW_DIR = /homeb/mbt/public_html/jcdf
1212

1313
TEST_JARFILE = jcdf_test.jar
14-
TEST_CDFS = data/*.cdf
14+
TEST_CDFS = data/example1.cdf data/example2.cdf data/test.cdf data/local/*.cdf
15+
TEST_BADLEAP = data/test_badleap.cdf
16+
LEAPSECONDS = data/CDFLeapSeconds.txt
1517
CDFLIBDIR = /mbt/local/lib
1618
CDFJARDIR = /mbt/local/jars
1719

@@ -110,9 +112,9 @@ updatewww: $(WWW_DIR)/index.html
110112
$(WWW_DIR)/index.html: index.html
111113
cp index.html $@
112114

113-
test: extest othertest convtest
115+
test: extest othertest badleaptest convtest
114116

115-
convtest: $(JARFILE) $(TEST_JARFILE) $(TEST_CDFS)
117+
convtest: $(JARFILE) $(TEST_JARFILE)
116118
rm -rf tmp; \
117119
mkdir tmp; \
118120
for f in $(TEST_CDFS); \
@@ -132,11 +134,29 @@ extest: $(JARFILE) $(TEST_JARFILE)
132134
data/example1.cdf data/example2.cdf data/test.cdf
133135

134136
othertest: $(JARFILE) $(TEST_JARFILE)
137+
# There is an error in the NASA java implementation at v3.6.0.3:
138+
# it doesn't have the 2015 leap year in it, which means this test
139+
# would fail. So import the updated leap seconds table with the
140+
# environment variable so it works. When the NASA lib is fixed
141+
# this can be removed.
135142
env LD_LIBRARY_PATH=$(CDFLIBDIR) \
143+
CDF_LEAPSECONDSTABLE=$(LEAPSECONDS) \
136144
java -ea \
137145
-classpath $(JARFILE):$(TEST_JARFILE):$(CDFJARDIR)/cdfjava.jar \
138146
uk.ac.bristol.star.cdf.test.OtherTest
139147

148+
badleaptest: $(JARFILE) data/test_badleap.cdf
149+
# This one should run OK
150+
java -classpath $(JARFILE) uk.ac.bristol.star.cdf.util.CdfDump \
151+
$(TEST_BADLEAP) >/dev/null
152+
# but this one should report that the file's leap seconds table
153+
# is out of date and exit with a RuntimeException
154+
if java -classpath $(JARFILE) \
155+
uk.ac.bristol.star.cdf.util.CdfList -data \
156+
$(TEST_BADLEAP) >/dev/null 2>&1; then \
157+
should_have_failed; \
158+
fi
159+
140160
clean:
141161
rm -rf $(JARFILE) $(TEST_JARFILE) tmp \
142162
index.html javadocs cdflist.html cdfdump.html

0 commit comments

Comments
 (0)