-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtests.xml
More file actions
982 lines (807 loc) · 33.6 KB
/
tests.xml
File metadata and controls
982 lines (807 loc) · 33.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
<!--
This file supports testing of RDataTracker. Each test case runs
RDataTracker and compares both its standard output and the created
ddg.json file to an expected result. The comparison ignores differences
related to file paths, platform executed on and timestamps. For each
test case, there is also a separate update task that can be used to
update the expected results.
To run it, use:
> ant -file tests.xml
Start with basicTest
> ant -file tests.xml basicTest
When you run a test, it will create several files with names like:
<target>.out - standard output from executing the test
ddg/ddg.json - ddg from executing the test
After a test is run, the .out files and the ddg.json files are compared
to expected_ files with the same names. The differences are displayed
on standard output. If the tests work as before, the only differences
you should see are in the execution time.
If the tests stop with Build failed, find the last test that was
attempted and look in its .out file(s). Perhaps a library function has
changed and the test needs to be updated. Perhaps the test needs a network
connection and you are not online. It is usually easy to understand the
problem by looking at the .out files.
If the test results differ from the expected results as reported by the
diff output at the end of the test case run, examine the results. If the
new version is incorrect, you should fix the problem and try again. If
the new version is correct, then you have either fixed a bug or added
an enhancement and should update the expected results. To do that, you
run an update task. Update tasks are only provided for individual tests
to reduce the likelihood that somebody would inadvertently update all the
expected results. The task is always named "update-<test>" where "<test>"
would be replaced with the name of the test, e.g. "update-basicTest".
When basicTest works, move on to "normal-tests" which will run the following
test cases:
- basicTest
- S4ObjectTest
- ScopeTest
- ReturnTest
- OddParameterTest
- FunctionAnnotationTest
- AnnotateOnOffTest
- ControlConstructTest
- WarningTest
- PlotTest
- Plot2Test
- NoDevOffTest
- DataTypeTest
- HigherOrderFuncTest
- AssignmentOperatorsTest
- RMarkdownTest
- DDGStatementTest
The target "source-tests" will run the following tests cases:
- SourceFuncTest
- OnOffTest <- temporarily removed
The target "bug-tests" will run the following test cases:
- ddgDeepNesting
The target "script-tests" will run all the short-running real scripts:
- CalculateSquareRoot
- DailySolarRadiation
- HFDatasetPreview
The target "test-all" will do all of the tests above.
To add a new test case, duplicate one of the existing test and update tasks,
modify the name of the task and the value passed to run-regression-test
and update-regression-expected. It is important that each test
script live in its own directory. The value passed to run-regression-test
and update-regression-expected should be the directory name. The
script inside that directory should have the same name, with .R appended to it.
When you add a new test case, you should also add it to one of the tasks that
group together test cases:
- normal-tests is used for basic R tests.
- script-tests is used for real R scripts that are short-running
- long-script-tests are used for real R scripts that are long-running
- bug-tests are tests that trigger a bug either in DDG Explorer or RDataTracker
-->
<project
name="TESTS"
xmlns:if="ant:if"
xmlns:unless="ant:unless"
default="install-and-test"
>
<!--############################# Start Setup #############################-->
<!-- Get the base directory -->
<dirname
property="TESTS.basedir"
file="${ant.file.TESTS}"
/>
<!-- For windows, we need to replace \ (backslashes) with / (forwardslashes) -->
<loadresource property="FILE.basedir">
<propertyresource name="TESTS.basedir"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replacestring from="\" to="/"/>
</tokenfilter>
</filterchain>
</loadresource>
<!--############################## End Setup ##############################-->
<!--############################ Start FUNCTIONS ############################-->
<!-- Check for libraries needed by the tests -->
<target name="dependencies">
<exec executable="Rscript" dir="tests/" >
<arg line="depends.r" />
</exec>
</target>
<!-- Run a specified tests. Parameters needed are :
@param dir : specified the directory where the test files are contained. This
directory should contain all files required by the test scripts
as this is the working directory
@param out : specified the relative location and name of the output file where
output from the script should be saved. If sourcing, a file is saved
in the same location with the prefix "source_" added to the name.
@param script-file : the name of the script file to be executed, relative to dir
@param expected_out : the location and name of the expected output for this test.
If sourcing, the expected source output is in the same location
with the prefix "source_" attached
@param expected_ddg : the location and name of the expected ddg.json for this test.
If sourcing, the expected source ddg.json is in the same directory
with the prefix "source_" attached
-->
<target name="run-test">
<!-- Directory to store local files for comparison -->
<property name="local_dir" value="${dir}/local" />
<delete dir="${local_dir}" quiet="true" />
<mkdir dir="${local_dir}" />
<!-- Copy the source test file to this directory, and replace with correct script name and directory -->
<copy file="${FILE.basedir}/tests/sourceTest.r" todir="${dir}" overwrite="true"/>
<replaceregexp file="${dir}/sourceTest.r"
match="\[DIR_LOCAL\]"
replace="${FILE.basedir}/${dir}"
flags="g"
/>
<replaceregexp file="${dir}/sourceTest.r"
match="\[SCRIPT\]"
replace="${script-file}"
flags="g"
/>
<replaceregexp file="${dir}/sourceTest.r"
match="\[DIR_DDG\]"
replace="${FILE.basedir}/${dir}/ddg"
flags="g"
/>
<!-- Execute the R Script (delete ddg directory first) -->
<delete dir="${dir}/ddg" quiet="true" />
<exec executable="Rscript" dir="${dir}" output="${FILE.basedir}/${out}" >
<arg line="sourceTest.r" />
</exec>
<!-- Obtain name of expected ddg.json, expected *.out, and actual *.out -->
<basename property="ddg_name" file="${expected_ddg}" />
<basename property="expected_out_name" file="${expected_out}" />
<basename property="out_name" file="${out}" />
<!-- Make copy of output files (.out and ddg.json) as well as expected
outputs for diff. Append .local to all files -->
<copy todir="${local_dir}" overwrite="true">
<!-- Executed ddg.json file -->
<fileset file="${dir}/ddg/ddg.json" />
<!-- all .out files and files ending in _ddg.json in the test directory -->
<fileset dir="${dir}">
<include name="*.out" />
<include name="*_ddg.json" />
</fileset>
<globmapper from="*" to="*.local"/>
</copy>
<!-- Delete all local environment information (except sourced scripts & installed packages) -->
<replaceregexp flags="g">
<regexp pattern='(("rdt:architecture"|"rdt:operatingSystem"|"rdt:language"|"rdt:rVersion"|"rdt:script"|"rdt:scriptTimeStamp"|"rdt:workingDirectory"|"rdt:ddgDirectory"|"rdt:MD5hash"|"rdt:ddgTimeStamp"|"rdt:rdatatrackerVersion") : (.*)\r?\n(,\r?\n)?)' />
<substitution expression=""/>
<fileset dir="${local_dir}">
<patternset id="local_files">
<include name="*.local" />
</patternset>
</fileset>
</replaceregexp>
<!-- Delete all sourced script timestamp occurrences -->
<replaceregexp flags="g">
<regexp pattern='("timestamp" : ("?([0-9]{4}-[0-9]{2}-[0-9]{2}(T| )[0-9]{2}(.|:)[0-9]{2}(.|:)[0-9]{2}[A-Z]{0,3})?"?))' />
<substitution expression=""/>
<fileset dir="${local_dir}">
<patternset id="local_files">
<include name="*.local" />
</patternset>
</fileset>
</replaceregexp>
<!-- Delete all entity timestamp occurrences -->
<replaceregexp flags="g">
<regexp pattern='("rdt:timestamp" : ("?([0-9]{4}-[0-9]{2}-[0-9]{2}(T| )[0-9]{2}(.|:)[0-9]{2}(.|:)[0-9]{2}[A-Z]{0,3})?"?,)\r?\n)' />
<substitution expression=""/>
<fileset dir="${local_dir}">
<patternset id="local_files">
<include name="*.local" />
</patternset>
</fileset>
</replaceregexp>
<!-- Delete all entity scope occurrences -->
<replaceregexp flags="g">
<regexp pattern='("rdt:scope" : ("(.*)",)\r?\n)' />
<substitution expression=""/>
<fileset dir="${local_dir}">
<patternset id="local_files">
<include name="*.local" />
</patternset>
</fileset>
</replaceregexp>
<!-- Delete all activity elapsed time occurrences -->
<replaceregexp flags="g">
<regexp pattern='("rdt:elapsedTime" : ("?[0-9]*\.?[0-9]+",)\r?\n)' />
<substitution expression=""/>
<fileset dir="${local_dir}">
<patternset id="local_files">
<include name="*.local" />
</patternset>
</fileset>
</replaceregexp>
<!-- Further edit the .local files if running tests on Travis -->
<antcall target="travis-edits"/>
<!-- Replace quotes on all local files -->
<replaceregexp flags="g">
<regexp pattern='\‘' />
<substitution expression="\'" />
<fileset dir="${local_dir}">
<patternset id="local_files">
<include name="*.local" />
</patternset>
</fileset>
</replaceregexp>
<replaceregexp flags="g">
<regexp pattern='\’' />
<substitution expression="\'" />
<fileset dir="${local_dir}">
<patternset id="local_files">
<include name="*.local" />
</patternset>
</fileset>
</replaceregexp>
<!-- Replace local file paths with [DIR] -->
<replaceregexp flags="g">
<regexp pattern="${FILE.basedir}/${dir}" />
<substitution expression="\[DIR\]"/>
<fileset dir="${local_dir}">
<patternset refid="local_files" />
</fileset>
</replaceregexp>
<!-- Fix line endings on all local files so diff works well -->
<fixcrlf srcdir="${local_dir}"
includes="*.local"
eol="lf"
eof="remove"
tab="remove"
tablength="2"
/>
<!-- Execute diff on .out files (always)-->
<echo>
Diff of (1) ${out_name}.local and (2) ${expected_out_name}.local:
</echo>
<exec executable="diff">
<arg line="--strip-trailing-cr ${local_dir}/${out_name}.local ${local_dir}/${expected_out_name}.local" />
</exec>
<!-- Exectute diff on .json files -->
<echo>
Diff of (1) ddg.json.local and (2) ${ddg_name}.local:
</echo>
<exec executable="diff">
<arg line="--strip-trailing-cr ${local_dir}/ddg.json.local ${local_dir}/${ddg_name}.local" />
</exec>
<echo>cmp (1) ddg.json.local and (2) ${ddg_name}.local:</echo>
<exec executable="cmp" failonerror="false" resultproperty="return.code.out">
<arg value="${local_dir}/${out_name}.local" />
<arg value="${local_dir}/${expected_out_name}.local" />
</exec>
<exec executable="cmp" failonerror="false" resultproperty="return.code.json">
<arg value="${local_dir}/ddg.json.local" />
<arg value="${local_dir}/${ddg_name}.local" />
</exec>
<!-- check for failure -->
<antcall target="failure-check"/>
</target>
<!-- Travis: Further edits the .local files for tests -->
<target name="travis-edits" if="using-travis">
<!-- Remove environment node -->
<replaceregexp byline="false" flags="s">
<regexp pattern='("environment" : \{)(.*)("entity":\{)' />
<substitution expression='},${line.separator}"entity":\{' />
<fileset dir="${local_dir}">
<patternset id="local_files">
<include name="*.local" />
</patternset>
</fileset>
</replaceregexp>
<!-- remove execution time from .out.local files -->
<replaceregexp>
<regexp pattern='Execution Time = ([0-9]*\.[0-9]+)${line.separator}' />
<substitution expression='' />
<fileset dir="${local_dir}">
<patternset id="local_files">
<include name="*.out.local" />
</patternset>
</fileset>
</replaceregexp>
</target>
<!-- Travis: Fails if a test does not pass -->
<target name="failure-check" if="using-travis">
<fail message="Does not match expected output.">
<condition>
<or>
<equals arg1="${return.code.out}" arg2="1"/>
<equals arg1="${return.code.json}" arg2="1"/>
</or>
</condition>
</fail>
</target>
<!-- Runs a test using a standard file naming scheme. -->
<target name = "run-regression-test">
<antcall target="run-test">
<param name="dir" value="tests/${test-name}" />
<param name="out" value="tests/${test-name}/${test-name}.out" />
<param name="script-file" value="${test-name}.R" />
<param name="expected_out" value="tests/${test-name}/expected_${test-name}.out" />
<param name="expected_ddg" value="tests/${test-name}/expected_${test-name}_ddg.json" />
</antcall>
</target>
<target name = "run-regression-test-Rmd">
<antcall target="run-test">
<param name="dir" value="tests/${test-name}" />
<param name="out" value="tests/${test-name}/${test-name}.out" />
<param name="script-file" value="${test-name}.Rmd" />
<param name="expected_out" value="tests/${test-name}/expected_${test-name}.out" />
<param name="expected_ddg" value="tests/${test-name}/expected_${test-name}_ddg.json" />
</antcall>
</target>
<!-- Updates the expected result files for a test case. -->
<!-- This should only be used when the expected results have changed for the better! -->
<target name="update-expected">
<!-- Confirm that the user wants to update the expected results. -->
<input
message="Do you want to update the expected results for ${dir}?"
validargs="y,n"
addproperty="do.update"
/>
<condition property="do.abort">
<not>
<equals arg1="y" arg2="${do.update}"/>
</not>
</condition>
<fail if="do.abort">Update aborted by user.</fail>
<!-- Directory to store expected results while editing -->
<property name="expected_dir" value="${dir}/expected" />
<delete dir="${expected_dir}" quiet="true" />
<mkdir dir="${expected_dir}" />
<!-- Make copy of ddg.json and the .out file into the expected folder -->
<copy todir="${expected_dir}" overwrite="true">
<!-- Executed ddg.json file -->
<fileset file="${dir}/ddg/ddg.json" />
<fileset file="${FILE.basedir}/${out}" />
</copy>
<!-- Replace local file paths with [DIR] -->
<replaceregexp flags="g">
<regexp pattern="${FILE.basedir}/${dir}" />
<substitution expression="\[DIR\]"/>
<fileset dir="${expected_dir}" />
</replaceregexp>
<!-- Move the edited files up to become the new expected results -->
<copy file="${expected_dir}/ddg.json" tofile="${expected_ddg}" overwrite="true" />
<basename property="out_name" file="${out}" />
<copy file="${expected_dir}/${out_name}" tofile="${expected_out}" overwrite="true" />
</target>
<!-- Task to update the expected results using the standard naming scheme -->
<target name = "update-regression-expected">
<antcall target="update-expected">
<param name="dir" value="tests/${test-name}"/>
<param name="out" value="tests/${test-name}/${test-name}.out"/>
<param name="expected_out" value="tests/${test-name}/expected_${test-name}.out"/>
<param name="expected_ddg" value="tests/${test-name}/expected_${test-name}_ddg.json"/>
</antcall>
</target>
<!--############################ End FUNCTIONS ############################-->
<!--########################## Start Basic TESTS ##########################-->
<target name="basicTest">
<antcall target="run-regression-test">
<param name="test-name" value="basicTest" />
</antcall>
</target>
<target name="update-basicTest">
<antcall target="update-regression-expected">
<param name="test-name" value="basicTest" />
</antcall>
</target>
<target name="S4ObjectTest">
<antcall target="run-regression-test">
<param name="test-name" value="S4ObjectTest" />
</antcall>
</target>
<target name="update-S4ObjectTest">
<antcall target="update-regression-expected">
<param name="test-name" value="S4ObjectTest" />
</antcall>
</target>
<target name="ScopeTest">
<antcall target="run-regression-test">
<param name="test-name" value="ScopeTest" />
</antcall>
</target>
<target name="update-ScopeTest">
<antcall target="update-regression-expected">
<param name="test-name" value="ScopeTest" />
</antcall>
</target>
<target name="ReturnTest">
<antcall target="run-regression-test">
<param name="test-name" value="ReturnTest" />
</antcall>
</target>
<target name="update-ReturnTest">
<antcall target="update-regression-expected">
<param name="test-name" value="ReturnTest" />
</antcall>
</target>
<target name="OddParameterTest">
<antcall target="run-regression-test">
<param name="test-name" value="OddParameterTest" />
</antcall>
</target>
<target name="update-OddParameterTest">
<antcall target="update-regression-expected">
<param name="test-name" value="OddParameterTest" />
</antcall>
</target>
<target name="FunctionAnnotationTest">
<antcall target="run-regression-test">
<param name="test-name" value="FunctionAnnotationTest" />
</antcall>
</target>
<target name="update-FunctionAnnotationTest">
<antcall target="update-regression-expected">
<param name="test-name" value="FunctionAnnotationTest" />
</antcall>
</target>
<target name="AnnotateOnOffTest">
<antcall target="run-regression-test">
<param name="test-name" value="AnnotateOnOffTest" />
</antcall>
</target>
<target name="update-AnnotateOnOffTest">
<antcall target="update-regression-expected">
<param name="test-name" value="AnnotateOnOffTest" />
</antcall>
</target>
<target name="ControlConstructTest">
<antcall target="run-regression-test">
<param name="test-name" value="ControlConstructTest" />
</antcall>
</target>
<target name="update-ControlConstructTest">
<antcall target="update-regression-expected">
<param name="test-name" value="ControlConstructTest" />
</antcall>
</target>
<target name="WarningTest">
<antcall target="run-regression-test">
<param name="test-name" value="WarningTest" />
</antcall>
</target>
<target name="update-WarningTest">
<antcall target="update-regression-expected">
<param name="test-name" value="WarningTest" />
</antcall>
</target>
<target name="PlotTest">
<antcall target="run-regression-test">
<param name="test-name" value="PlotTest" />
</antcall>
</target>
<target name="update-PlotTest">
<antcall target="update-regression-expected">
<param name="test-name" value="PlotTest" />
</antcall>
</target>
<target name="Plot2Test">
<antcall target="run-regression-test">
<param name="test-name" value="Plot2Test" />
</antcall>
</target>
<target name="update-Plot2Test">
<antcall target="update-regression-expected">
<param name="test-name" value="Plot2Test" />
</antcall>
</target>
<target name="NoDevOffTest">
<antcall target="run-regression-test">
<param name="test-name" value="NoDevOffTest" />
</antcall>
</target>
<target name="update-NoDevOffTest">
<antcall target="update-regression-expected">
<param name="test-name" value="NoDevOffTest" />
</antcall>
</target>
<target name="DataTypeTest">
<antcall target="run-regression-test">
<param name="test-name" value="DataTypeTest" />
</antcall>
</target>
<target name="update-DataTypeTest">
<antcall target="update-regression-expected">
<param name="test-name" value="DataTypeTest" />
</antcall>
</target>
<target name="HigherOrderFuncTest">
<antcall target="run-regression-test">
<param name="test-name" value="HigherOrderFuncTest" />
</antcall>
</target>
<target name="update-HigherOrderFuncTest">
<antcall target="update-regression-expected">
<param name="test-name" value="HigherOrderFuncTest" />
</antcall>
</target>
<target name="AssignmentOperatorsTest">
<antcall target="run-regression-test">
<param name="test-name" value="AssignmentOperatorsTest" />
</antcall>
</target>
<target name="update-AssignmentOperatorsTest">
<antcall target="update-regression-expected">
<param name="test-name" value="AssignmentOperatorsTest" />
</antcall>
</target>
<target name="DDGStatementTest">
<antcall target="run-regression-test">
<param name="test-name" value="DDGStatementTest" />
</antcall>
</target>
<target name="update-DDGStatementTest">
<antcall target="update-regression-expected">
<param name="test-name" value="DDGStatementTest" />
</antcall>
</target>
<target name="RMarkdownTest">
<antcall target="run-regression-test-Rmd">
<param name="test-name" value="RMarkdownTest" />
</antcall>
</target>
<target name="update-RMarkdownTest">
<antcall target="update-regression-expected">
<param name="test-name" value="RMarkdownTest" />
</antcall>
</target>
<target name="normal-tests" depends="basicTest, S4ObjectTest,
ScopeTest, ReturnTest, OddParameterTest, FunctionAnnotationTest,
ControlConstructTest, WarningTest, PlotTest, Plot2Test, NoDevOffTest, DataTypeTest,
HigherOrderFuncTest, AssignmentOperatorsTest, RMarkdownTest, DDGStatementTest">
<echo>
##############################################
Finished Execution of Normal Tests. Nothing should have malfunctioned.
##############################################
</echo>
</target>
<!--########################## End Basic TESTS ##########################-->
<!--########################## Start Checkpoint TESTS ##########################-->
<target name="CheckpointTest">
<antcall target="run-regression-test">
<param name="test-name" value="CheckpointTest" />
</antcall>
</target>
<target name="update-CheckpointTest">
<antcall target="update-regression-expected">
<param name="test-name" value="CheckpointTest" />
</antcall>
</target>
<target name="CheckpointFileTest">
<antcall target="run-regression-test">
<param name="test-name" value="CheckpointFileTest" />
</antcall>
</target>
<target name="update-CheckpointFileTest">
<antcall target="update-regression-expected">
<param name="test-name" value="CheckpointFileTest" />
</antcall>
</target>
<target name="checkpoint-tests" depends="CheckpointTest, CheckpointFileTest">
<echo>
##############################################
Finished Execution of Checkpoint Tests. Expect differences in output for checkpoint-file-test due to directory creation in Windows (using : and spaces).
##############################################
</echo>
</target>
<!--########################## End Checkpoint TESTS ##########################-->
<!--########################## Start Source Tests ##########################-->
<target name="SourceFuncTest">
<antcall target="run-regression-test">
<param name="test-name" value="SourceFuncTest" />
</antcall>
</target>
<target name="update-SourceFuncTest">
<antcall target="update-regression-expected">
<param name="test-name" value="SourceFuncTest" />
</antcall>
</target>
<target name="OnOffTest">
<antcall target="run-regression-test">
<param name="test-name" value="OnOffTest" />
</antcall>
</target>
<target name="update-OnOffTest">
<antcall target="update-regression-expected">
<param name="test-name" value="OnOffTest" />
</antcall>
</target>
<!--<target name="source-tests" depends="SourceFuncTest, OnOffTest">-->
<target name="source-tests" depends="SourceFuncTest">
<echo>Finished Execution of Source Tests.</echo>
</target>
<!--########################## End Source TESTS ##########################-->
<!--########################## Start Script Tests ##########################-->
<target name="CalculateSquareRoot">
<antcall target="run-regression-test">
<param name="test-name" value="CalculateSquareRoot" />
</antcall>
</target>
<target name="update-CalculateSquareRoot">
<antcall target="update-regression-expected">
<param name="test-name" value="CalculateSquareRoot" />
</antcall>
</target>
<target name="DailySolarRadiation">
<antcall target="run-regression-test">
<param name="test-name" value="DailySolarRadiation" />
</antcall>
</target>
<target name="update-DailySolarRadiation">
<antcall target="update-regression-expected">
<param name="test-name" value="DailySolarRadiation" />
</antcall>
</target>
<target name="HFDatasetPreview">
<antcall target="run-regression-test">
<param name="test-name" value="HFDatasetPreview" />
</antcall>
<echo>The test requires RCurl and gplots (+ dependencies) to be installed.</echo>
</target>
<target name="update-HFDatasetPreview">
<antcall target="update-regression-expected">
<param name="test-name" value="HFDatasetPreview" />
</antcall>
</target>
<target name="SivanSamplingSmaller">
<antcall target="run-regression-test">
<param name="test-name" value="SivanSamplingSmaller" />
</antcall>
<echo>This script uses randomization.</echo>
</target>
<target name="update-SivanSamplingSmaller">
<antcall target="update-regression-expected">
<param name="test-name" value="SivanSamplingSmaller" />
</antcall>
</target>
<!-- SivanSampling is not currently included in the test suites because it collects too much data -->
<target name="SivanSampling">
<antcall target="run-regression-test">
<param name="test-name" value="SivanSampling" />
</antcall>
<echo>This script uses randomization.</echo>
</target>
<target name="update-SivanSampling">
<antcall target="update-regression-expected">
<param name="test-name" value="SivanSampling" />
</antcall>
</target>
<target name="script-tests" depends="CalculateSquareRoot, DailySolarRadiation, HFDatasetPreview">
<echo>Script tests for which output should not differ </echo>
</target>
<!--########################## End Script Tests ##########################-->
<!--########################## Start Interactive Tests ##########################-->
<target name="RealTime15MinMET">
<antcall target="run-regression-test">
<param name="test-name" value="RealTime15MinMET" />
</antcall>
</target>
<target name="update-RealTime15MinMET">
<antcall target="update-regression-expected">
<param name="test-name" value="RealTime15MinMET" />
</antcall>
</target>
<target name="QualityControl15Min">
<antcall target="run-regression-test">
<param name="test-name" value="QualityControl15Min" />
</antcall>
</target>
<target name="update-QualityControl15Min">
<antcall target="update-regression-expected">
<param name="test-name" value="QualityControl15Min" />
</antcall>
</target>
<target name="interactive-tests" depends="RealTime15MinMET, QualityControl15Min">
<echo>Script tests for which the user needs to provide input </echo>
</target>
<target name="AaronSimesDendrochronology">
<antcall target="run-regression-test">
<param name="test-name" value="AaronSimesDendrochronology" />
</antcall>
</target>
<target name="update-AaronSimesDendrochronology">
<antcall target="update-regression-expected">
<param name="test-name" value="AaronSimesDendrochronology" />
</antcall>
</target>
<target name="long-script-tests" depends="AaronSimesDendrochronology" >
<echo>Long tests derived from real-world scripts. </echo>
</target>
<!--########################## End Interactive Tests ##########################-->
<!--########################## Start Bug Tests ##########################-->
<target name="ddgDeepNesting">
<antcall target="run-regression-test">
<param name="test-name" value="ddgDeepNesting" />
</antcall>
</target>
<target name="update-ddgDeepNesting">
<antcall target="update-regression-expected">
<param name="test-name" value="ddgDeepNesting" />
</antcall>
</target>
<target name="bug-tests" depends="ddgDeepNesting" >
<echo>Tests which were added to check for specific bug fixes </echo>
</target>
<!--########################## End Bug Tests ##########################-->
<!--################################# MAIN #################################-->
<target name="quick-test" depends="normal-tests, source-tests, bug-tests" description="Run quick regressions tests for the currently installed RDataTracker Package.">
<echo>This batch of tests is quick to execute, but not as extensive.</echo>
</target>
<target name="long-test" depends="script-tests" description="Run long regression tests for the currently installed RDataTracker Package.">
<echo>This batch of tests takes longer, but is a bit more real-world</echo>
</target>
<!-- Target for tests run by people -->
<target name="test-all" depends="quick-test, long-test" description="Run all regression tests for the currently installed RDataTracker Package.">
<echo>All tests makes calls to the RDataTracker Library. You might need to restart RStudio to correctly run the scripts with the updated library installed. Output is saved in tests.log.</echo>
</target>
<!-- Target for tests run by Travis -->
<target name="test-travis" description="Runs all regression tests for the currently installed RDataTracker Package on Travis.">
<property name="using-travis" value="true"/>
<antcall target="quick-test"/>
<antcall target="long-test"/>
<echo>All tests makes calls to the RDataTracker Library. You might need to restart RStudio to correctly run the scripts with the updated library installed. Output is saved in tests.log.</echo>
</target>
<target name="install-and-test" description="Install the RDataTracker Package and perform all normal regression tests.">
<splash displaytext="Installing and Testing" />
<record name="tests.log" action="start" />
<antcall target="test-all" />
<record name="tests.log" action="stop" />
</target>
<!--################################# END MAIN #################################-->
<!--################################# UTILIES #################################-->
<!-- Test interactive() function when calling from command line -->
<target name="interactive-test">
<exec executable="Rscript" dir="tests" >
<arg line="RscriptTest.r" />
</exec>
</target>
<!-- Execute the script timer, which looks in the examples/ directory for all
files with a (-clear.r) suffix and a (template_)*(-annotated.r) pattern and
combined matching pairs to create a timing test. It executes a clean version of
the script, then minimally annotated the clean version and executes a console
and source version, and finally executes the annotated version.
This data is saved in the examples/_timingResults/ directory under the data/time
of execution.
-->
<target name="script-timer" depends="dependencies">
<splash displaytext="Running Performance Tests" />
<!-- Replace base.dir with the base directory of the project -->
<replaceregexp file="utilities/scriptTimer.r"
match="base.dir <- (.*)"
replace='base.dir <- "${FILE.basedir}"'
/>
<record name="script-timer.log" action="start" />
<exec executable="Rscript" dir="utilities">
<arg line="scriptTimer.r execute" />
</exec>
<record name="script-timer.log" action="stop" />
</target>
<!-- Executes the same as above, but logs a lot more information on each
script -->
<target name="script-timer-debug" depends="dependencies">
<replaceregexp file="utilities/scriptTimer.r"
match="base.dir <- (.*)"
replace='base.dir <- "${FILE.basedir}"'
/>
<record name="script-timer-debug.log" action="start" />
<exec executable="Rscript" dir="utilities">
<arg line="scriptTimer.r execute debug" />
</exec>
<record name="script-timer-debug.log" action="stop" />
</target>
<!-- Executes utilities/plot.r. Within this file, scriptTimer.r is executed (making the above
and unnecessary dependence).
-->
<target name="performance-report" depends="dependencies" description="Execute performance scripts on the current version of the library and generate a report.">
<splash displaytext="Creating Performance Report."/>
<!-- Replace base.dir with the base directory of the project -->
<replaceregexp file="utilities/plot.r"
match="base.dir <- (.*)"
replace='base.dir <- "${FILE.basedir}"'
/>
<record name="plot-performance.log" action="start" />
<exec executable="Rscript" dir="utilities">
<arg line="plot.r plot _plots" />
</exec>
<record name="plot-performance.log" action="stop" />
</target>
<!--################################# END UTILIES #################################-->
</project>