]>
Commit | Line | Data |
---|---|---|
3d1f044b A |
1 | # Copyright (C) 2018 and later: Unicode, Inc. and others. |
2 | # License & terms of use: http://www.unicode.org/copyright.html | |
3 | ||
4 | from distutils.sysconfig import parse_makefile | |
5 | ||
6 | from buildtool import * | |
7 | from buildtool.request_types import * | |
8 | ||
9 | ||
10 | def generate(config, glob, common_vars): | |
11 | requests = [] | |
12 | requests += generate_rb(config, glob, common_vars) | |
13 | requests += generate_sprep(config, glob, common_vars) | |
14 | requests += generate_conv(config, glob, common_vars) | |
15 | requests += generate_other(config, glob, common_vars) | |
16 | requests += generate_copy(config, glob, common_vars) | |
17 | ||
18 | requests += [ | |
19 | ListRequest( | |
20 | name = "testdata_list", | |
21 | variable_name = "testdata_all_output_files", | |
22 | output_file = TmpFile("testdata.lst"), | |
23 | include_tmp = True | |
24 | ) | |
25 | ] | |
26 | ||
27 | return requests | |
28 | ||
29 | ||
30 | def generate_rb(config, glob, common_vars): | |
31 | mk_vars = parse_makefile("{GLOB_DIR}/tstfiles.mk".format(**common_vars)) | |
32 | basenames = [v[:-4] for v in mk_vars["TEST_RES_SOURCE"].split()] | |
33 | basenames += [ | |
34 | "casing", | |
35 | "mc", | |
36 | "root", | |
37 | "sh", | |
38 | "sh_YU", | |
39 | "te", | |
40 | "te_IN", | |
41 | "te_IN_REVISED", | |
42 | "testtypes", | |
43 | "testaliases", | |
44 | "testempty", | |
45 | "structLocale", | |
46 | "idna_rules", | |
47 | "conversion", | |
48 | "icuio", | |
49 | # "metaZones", | |
50 | # "timezoneTypes", | |
51 | # "windowsZones", | |
52 | ] | |
53 | return [ | |
54 | # Inference rule for creating resource bundles | |
55 | # Some test data resource bundles are known to have warnings and bad data. | |
56 | # The -q option is there on purpose, so we don't see it normally. | |
57 | # TODO: Use option -k? | |
58 | RepeatedExecutionRequest( | |
59 | name = "testrb", | |
60 | category = "tests", | |
61 | input_files = [InFile("%s.txt" % bn) for bn in basenames], | |
62 | output_files = [OutFile("%s.res" % bn) for bn in basenames], | |
63 | tool = IcuTool("genrb"), | |
64 | args = "-q -s {IN_DIR} -d {OUT_DIR} {INPUT_FILE}", | |
65 | format_with = {}, | |
66 | repeat_with = {} | |
67 | ), | |
68 | # Other standalone res files | |
69 | SingleExecutionRequest( | |
70 | name = "encoded", | |
71 | category = "tests", | |
72 | input_files = [InFile("encoded.utf16be")], | |
73 | output_files = [OutFile("encoded.res")], | |
74 | tool = IcuTool("genrb"), | |
75 | args = "-s {IN_DIR} -eUTF-16BE -d {OUT_DIR} {INPUT_FILES[0]}", | |
76 | format_with = {} | |
77 | ), | |
78 | SingleExecutionRequest( | |
79 | name = "zoneinfo64", | |
80 | category = "tests", | |
81 | input_files = [InFile("zoneinfo64.txt")], | |
82 | output_files = [TmpFile("zoneinfo64.res")], | |
83 | tool = IcuTool("genrb"), | |
84 | args = "-s {IN_DIR} -d {TMP_DIR} {INPUT_FILES[0]}", | |
85 | format_with = {} | |
86 | ), | |
87 | SingleExecutionRequest( | |
88 | name = "filtertest", | |
89 | category = "tests", | |
90 | input_files = [InFile("filtertest.txt")], | |
91 | output_files = [OutFile("filtertest.res")], | |
92 | tool = IcuTool("genrb"), | |
93 | args = "-s {IN_DIR} -d {OUT_DIR} -i {OUT_DIR} " | |
94 | "--filterDir {IN_DIR}/filters filtertest.txt", | |
95 | format_with = {} | |
96 | ) | |
97 | ] | |
98 | ||
99 | ||
100 | def generate_sprep(config, glob, common_vars): | |
101 | return [ | |
102 | SingleExecutionRequest( | |
103 | name = "nfscsi", | |
104 | category = "tests", | |
105 | input_files = [InFile("nfs4_cs_prep_ci.txt")], | |
106 | output_files = [OutFile("nfscsi.spp")], | |
107 | tool = IcuTool("gensprep"), | |
108 | args = "-s {IN_DIR} -d {OUT_DIR} -b nfscsi -u 3.2.0 {INPUT_FILES[0]}", | |
109 | format_with = {} | |
110 | ), | |
111 | SingleExecutionRequest( | |
112 | name = "nfscss", | |
113 | category = "tests", | |
114 | input_files = [InFile("nfs4_cs_prep_cs.txt")], | |
115 | output_files = [OutFile("nfscss.spp")], | |
116 | tool = IcuTool("gensprep"), | |
117 | args = "-s {IN_DIR} -d {OUT_DIR} -b nfscss -u 3.2.0 {INPUT_FILES[0]}", | |
118 | format_with = {} | |
119 | ), | |
120 | SingleExecutionRequest( | |
121 | name = "nfscis", | |
122 | category = "tests", | |
123 | input_files = [InFile("nfs4_cis_prep.txt")], | |
124 | output_files = [OutFile("nfscis.spp")], | |
125 | tool = IcuTool("gensprep"), | |
126 | args = "-s {IN_DIR} -d {OUT_DIR} -b nfscis -u 3.2.0 -k -n {IN_DIR}/../../data/unidata {INPUT_FILES[0]}", | |
127 | format_with = {} | |
128 | ), | |
129 | SingleExecutionRequest( | |
130 | name = "nfsmxs", | |
131 | category = "tests", | |
132 | input_files = [InFile("nfs4_mixed_prep_s.txt")], | |
133 | output_files = [OutFile("nfsmxs.spp")], | |
134 | tool = IcuTool("gensprep"), | |
135 | args = "-s {IN_DIR} -d {OUT_DIR} -b nfsmxs -u 3.2.0 -k -n {IN_DIR}/../../data/unidata {INPUT_FILES[0]}", | |
136 | format_with = {} | |
137 | ), | |
138 | SingleExecutionRequest( | |
139 | name = "nfsmxp", | |
140 | category = "tests", | |
141 | input_files = [InFile("nfs4_mixed_prep_p.txt")], | |
142 | output_files = [OutFile("nfsmxp.spp")], | |
143 | tool = IcuTool("gensprep"), | |
144 | args = "-s {IN_DIR} -d {OUT_DIR} -b nfsmxp -u 3.2.0 -k -n {IN_DIR}/../../data/unidata {INPUT_FILES[0]}", | |
145 | format_with = {} | |
146 | ) | |
147 | ] | |
148 | ||
149 | ||
150 | def generate_conv(config, glob, common_vars): | |
151 | basenames = [ | |
152 | "test1", | |
153 | "test1bmp", | |
154 | "test2", | |
155 | "test3", | |
156 | "test4", | |
157 | "test4x", | |
158 | "test5", | |
159 | "ibm9027" | |
160 | ] | |
161 | return [ | |
162 | RepeatedExecutionRequest( | |
163 | name = "test_conv", | |
164 | category = "tests", | |
165 | input_files = [InFile("%s.ucm" % bn) for bn in basenames], | |
166 | output_files = [OutFile("%s.cnv" % bn) for bn in basenames], | |
167 | tool = IcuTool("makeconv"), | |
168 | args = "--small -d {OUT_DIR} {IN_DIR}/{INPUT_FILE}", | |
169 | format_with = {}, | |
170 | repeat_with = {} | |
171 | ) | |
172 | ] | |
173 | ||
174 | ||
175 | def generate_copy(config, glob, common_vars): | |
176 | return [ | |
177 | CopyRequest( | |
178 | name = "nam_typ", | |
179 | input_file = OutFile("te.res"), | |
180 | output_file = TmpFile("nam.typ") | |
181 | ), | |
182 | CopyRequest( | |
183 | name = "old_l_testtypes", | |
184 | input_file = InFile("old_l_testtypes.res"), | |
185 | output_file = OutFile("old_l_testtypes.res") | |
186 | ), | |
187 | CopyRequest( | |
188 | name = "old_e_testtypes", | |
189 | input_file = InFile("old_e_testtypes.res"), | |
190 | output_file = OutFile("old_e_testtypes.res") | |
191 | ), | |
192 | ] | |
193 | ||
194 | ||
195 | def generate_other(config, glob, common_vars): | |
196 | return [ | |
197 | SingleExecutionRequest( | |
198 | name = "testnorm", | |
199 | category = "tests", | |
200 | input_files = [InFile("testnorm.txt")], | |
201 | output_files = [OutFile("testnorm.nrm")], | |
202 | tool = IcuTool("gennorm2"), | |
203 | args = "-s {IN_DIR} {INPUT_FILES[0]} -o {OUT_DIR}/{OUTPUT_FILES[0]}", | |
204 | format_with = {} | |
205 | ), | |
206 | SingleExecutionRequest( | |
207 | name = "test_icu", | |
208 | category = "tests", | |
209 | input_files = [], | |
210 | output_files = [OutFile("test.icu")], | |
211 | tool = IcuTool("gentest"), | |
212 | args = "-d {OUT_DIR}", | |
213 | format_with = {} | |
214 | ), | |
215 | SingleExecutionRequest( | |
216 | name = "testtable32_txt", | |
217 | category = "tests", | |
218 | input_files = [], | |
219 | output_files = [TmpFile("testtable32.txt")], | |
220 | tool = IcuTool("gentest"), | |
221 | args = "-r -d {TMP_DIR}", | |
222 | format_with = {} | |
223 | ), | |
224 | SingleExecutionRequest( | |
225 | name = "testtable32_res", | |
226 | category = "tests", | |
227 | input_files = [TmpFile("testtable32.txt")], | |
228 | output_files = [OutFile("testtable32.res")], | |
229 | tool = IcuTool("genrb"), | |
230 | args = "-s {TMP_DIR} -d {OUT_DIR} {INPUT_FILES[0]}", | |
231 | format_with = {} | |
232 | ) | |
233 | ] |