Debian Codegraph @

intl/icu/source/test/testdata/BUILDRULES.py

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