• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@echo off
2REM Copyright (C) 2016 and later: Unicode, Inc. and others.
3REM License & terms of use: http://www.unicode.org/copyright.html
4REM  ********************************************************************
5
6REM Don't add additional global environment variables, keep the variables local to this script.
7rem setlocal
8
9set ICU_ARCH=%1
10set ICU_DBRL=%2
11
12if "%1" == "" (
13 echo Usage: %0 "x86 or x64"  "Debug or Release"
14 exit /b 1
15)
16
17if "%2" == "" (
18 echo Usage: %0 %1 "Debug or Release"
19 exit /b 1
20)
21
22set ICU_ICUDIR="%~dp0"\..\..\..
23set ICU_SAMPLESDIR=%ICU_ICUDIR%\source\samples
24
25if "%ICU_ARCH%" == "x64" (
26 set ICU_BINDIR=%~dp0..\..\..\bin64
27) else (
28 set ICU_BINDIR=%~dp0..\..\..\bin
29)
30
31if not exist "%ICU_BINDIR%" (
32 echo Error '%ICU_BINDIR%' does not exist!
33 echo Have you built all of ICU yet ?
34 goto :eof
35)
36
37echo Testing ICU samples in %ICU_ICUDIR%  arch=%ICU_ARCH% type=%ICU_DBRL%
38set PATH=%ICU_BINDIR%;%PATH%
39pushd %ICU_BINDIR%
40
41set SAMPLE_BREAK=%ICU_SAMPLESDIR%\break\%ICU_ARCH%\%ICU_DBRL%\break.exe
42set SAMPLE_CAL=%ICU_SAMPLESDIR%\cal\%ICU_ARCH%\%ICU_DBRL%\cal.exe
43set SAMPLE_CASE=%ICU_SAMPLESDIR%\case\%ICU_ARCH%\%ICU_DBRL%\case.exe
44set SAMPLE_CITER=%ICU_SAMPLESDIR%\citer\%ICU_ARCH%\%ICU_DBRL%\citer.exe
45set SAMPLE_COLL=%ICU_SAMPLESDIR%\coll\%ICU_ARCH%\%ICU_DBRL%\coll.exe
46set SAMPLE_CSDET=%ICU_SAMPLESDIR%\csdet\%ICU_ARCH%\%ICU_DBRL%\csdet.exe
47set SAMPLE_DATE=%ICU_SAMPLESDIR%\date\%ICU_ARCH%\%ICU_DBRL%\date.exe
48set SAMPLE_DATEFMT=%ICU_SAMPLESDIR%\datefmt\%ICU_ARCH%\%ICU_DBRL%\datefmt.exe
49set SAMPLE_DTITVFMT=%ICU_SAMPLESDIR%\dtitvfmtsample\%ICU_ARCH%\%ICU_DBRL%\dtitvfmtsample.exe
50set SAMPLE_DTPTNG=%ICU_SAMPLESDIR%\dtptngsample\%ICU_ARCH%\%ICU_DBRL%\dtptngsample.exe
51set SAMPLE_MSGFMT=%ICU_SAMPLESDIR%\msgfmt\%ICU_ARCH%\%ICU_DBRL%\msgfmt.exe
52set SAMPLE_NUMFMT=%ICU_SAMPLESDIR%\numfmt\%ICU_ARCH%\%ICU_DBRL%\numfmt.exe
53set SAMPLE_PLURFMTSAMPLE=%ICU_SAMPLESDIR%\plurfmtsample\%ICU_ARCH%\%ICU_DBRL%\plurfmtsample.exe
54set SAMPLE_PROPS=%ICU_SAMPLESDIR%\props\%ICU_ARCH%\%ICU_DBRL%\props.exe
55set SAMPLE_STRSRCH=%ICU_SAMPLESDIR%\strsrch\%ICU_ARCH%\%ICU_DBRL%\strsrch.exe
56set SAMPLE_TRANSLIT=%ICU_SAMPLESDIR%\translit\%ICU_ARCH%\%ICU_DBRL%\translit.exe
57set SAMPLE_UCITER8=%ICU_SAMPLESDIR%\uciter8\%ICU_ARCH%\%ICU_DBRL%\uciter8.exe
58set SAMPLE_UCNV=%ICU_SAMPLESDIR%\ucnv\%ICU_ARCH%\%ICU_DBRL%\ucnv.exe
59REM udata needs changes to the vcxproj to change the output locations for writer/reader.
60rem set SAMPLE_UDATA_WRITER=%ICU_SAMPLESDIR%\udata\%ICU_ARCH%\%ICU_DBRL%\writer.exe
61rem set SAMPLE_UDATA_READER=%ICU_SAMPLESDIR%\udata\%ICU_ARCH%\%ICU_DBRL%\reader.exe
62set SAMPLE_UFORTUNE=%ICU_SAMPLESDIR%\ufortune\%ICU_ARCH%\%ICU_DBRL%\ufortune.exe
63set SAMPLE_UGREP=%ICU_SAMPLESDIR%\ugrep\%ICU_ARCH%\%ICU_DBRL%\ugrep.exe
64REM There is also the 'resources' project in VS.
65set SAMPLE_URESB=%ICU_SAMPLESDIR%\uresb\%ICU_ARCH%\%ICU_DBRL%\uresb.exe
66set SAMPLE_USTRING=%ICU_SAMPLESDIR%\ustring\%ICU_ARCH%\%ICU_DBRL%\ustring.exe
67
68
69@set THT=break
70@echo.
71@echo ==== %THT% =========================================================================
72%SAMPLE_BREAK%
73if ERRORLEVEL 1 goto :SampleError
74
75@set THT=cal
76@echo.
77@echo ==== %THT% =========================================================================
78%SAMPLE_CAL%
79if ERRORLEVEL 1 goto :SampleError
80
81@set THT=case
82@echo.
83@echo ==== %THT% =========================================================================
84%SAMPLE_CASE%
85if ERRORLEVEL 1 goto :SampleError
86
87@set THT=citer
88@echo.
89@echo ==== %THT% =========================================================================
90%SAMPLE_CITER%
91if ERRORLEVEL 1 goto :SampleError
92
93@set THT=coll
94@echo.
95@echo ==== %THT% =========================================================================
96%SAMPLE_COLL%
97if ERRORLEVEL 1 goto :SampleError
98
99@set THT=csdet
100@echo.
101@echo ==== %THT% =========================================================================
102%SAMPLE_CSDET% %ICU_SAMPLESDIR%\csdet\readme.txt
103if ERRORLEVEL 1 goto :SampleError
104
105@set THT=date
106@echo.
107@echo ==== %THT% =========================================================================
108%SAMPLE_DATE%
109if ERRORLEVEL 1 goto :SampleError
110
111@set THT=datefmt
112@echo.
113@echo ==== %THT% =========================================================================
114%SAMPLE_DATEFMT%
115if ERRORLEVEL 1 goto :SampleError
116
117@set THT=dtitvfmtsample
118@echo.
119@echo ==== %THT% =========================================================================
120%SAMPLE_DTITVFMT%
121if ERRORLEVEL 1 goto :SampleError
122
123@set THT=dtptngsample
124@echo.
125@echo ==== %THT% =========================================================================
126pushd %ICU_SAMPLESDIR%\dtptngsample\%ICU_ARCH%\%ICU_DBRL%
127%SAMPLE_DTPTNG%
128popd
129if ERRORLEVEL 1 goto :SampleError
130
131@set THT=msgfmt
132@echo.
133@echo ==== %THT% =========================================================================
134%SAMPLE_MSGFMT% arg1 arg2
135if ERRORLEVEL 1 goto :SampleError
136
137@set THT=numfmt
138@echo.
139@echo ==== %THT% =========================================================================
140%SAMPLE_NUMFMT%
141if ERRORLEVEL 1 goto :SampleError
142
143@set THT=plurfmtsample
144@echo.
145@echo ==== %THT% =========================================================================
146%SAMPLE_PLURFMTSAMPLE%
147if ERRORLEVEL 1 goto :SampleError
148
149@set THT=props
150@echo.
151@echo ==== %THT% =========================================================================
152%SAMPLE_PROPS%
153if ERRORLEVEL 1 goto :SampleError
154
155@set THT=strsrch
156@echo.
157@echo ==== %THT% =========================================================================
158%SAMPLE_STRSRCH%
159if ERRORLEVEL 1 goto :SampleError
160
161@set THT=translit
162@echo.
163@echo ==== %THT% =========================================================================
164%SAMPLE_TRANSLIT%
165if ERRORLEVEL 1 goto :SampleError
166
167@set THT=citer8
168@echo.
169@echo ==== %THT% =========================================================================
170%SAMPLE_UCITER8%
171if ERRORLEVEL 1 goto :SampleError
172
173@set THT=ucnv
174@echo.
175@echo ==== %THT% =========================================================================
176pushd %ICU_SAMPLESDIR%\ucnv
177%SAMPLE_UCNV%
178popd
179if ERRORLEVEL 1 goto :SampleError
180
181REM TODO: udata needs changes to the vcxproj file to fix the output locations for writer/reader.
182@set THT=udata
183@echo.
184@echo ==== %THT% =========================================================================
185pushd %ICU_SAMPLESDIR%\udata\%ICU_ARCH%\%ICU_DBRL%
186@echo TODO: udata needs changes to the vcxproj file to fix the output locations for writer/reader.
187@echo Skipping %THT%
188rem %SAMPLE_UDATA_WRITER%
189rem %SAMPLE_UDATA_READER%
190popd
191if ERRORLEVEL 1 goto :SampleError
192
193@set THT=ufortune
194@echo.
195@echo ==== %THT% =========================================================================
196if "%ICU_ARCH%" == "x64" (
197    @echo The ufortune sample currently only runs on x86.
198    @echo Skipping %THT%.
199) else (
200    %SAMPLE_UFORTUNE%
201    if ERRORLEVEL 1 goto :SampleError
202)
203
204@set THT=ugrep
205@echo.
206@echo ==== %THT% =========================================================================
207echo Looking for "ICU" in '%ICU_SAMPLESDIR%\ugrep\readme.txt' with ugrep.exe
208%SAMPLE_UGREP% ICU %ICU_SAMPLESDIR%\ugrep\readme.txt
209if ERRORLEVEL 1 goto :SampleError
210
211@set THT=uresb
212@echo.
213@echo ==== %THT% =========================================================================
214pushd %ICU_SAMPLESDIR%\uresb
215%SAMPLE_URESB% en
216%SAMPLE_URESB% root
217%SAMPLE_URESB% sr
218popd
219if ERRORLEVEL 1 goto :SampleError
220
221@set THT=ustring
222@echo.
223@echo ==== %THT% =========================================================================
224%SAMPLE_USTRING%
225if ERRORLEVEL 1 goto :SampleError
226
227
228
229rem All done
230goto :QuitWithNoError
231
232:SampleError
233 echo.
234 echo ERROR: Sample program %THT% did not exit cleanly. Stopping execution.
235 echo.
236 goto :QuitWithError
237
238:QuitWithNoError
239 echo.
240 popd
241 exit /b 0
242
243:QuitWithError
244 echo.
245 popd
246 rem Exit with non-zero error code.
247 exit /b 1
248