• 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
37REM Change the codepage to UTF-8 in order to better handle non-ASCII characters from the samples.
38echo Setting codepage to UTF-8
39chcp 65001
40
41echo Testing ICU samples in %ICU_ICUDIR%  arch=%ICU_ARCH% type=%ICU_DBRL%
42set PATH=%ICU_BINDIR%;%PATH%
43pushd %ICU_BINDIR%
44
45set SAMPLE_COLL=%ICU_SAMPLESDIR%\coll\%ICU_ARCH%\%ICU_DBRL%\coll.exe
46set SAMPLE_STRSRCH=%ICU_SAMPLESDIR%\strsrch\%ICU_ARCH%\%ICU_DBRL%\strsrch.exe
47set SAMPLE_TRANSLIT=%ICU_SAMPLESDIR%\translit\%ICU_ARCH%\%ICU_DBRL%\translit.exe
48set SAMPLE_UGREP=%ICU_SAMPLESDIR%\ugrep\%ICU_ARCH%\%ICU_DBRL%\ugrep.exe
49
50
51@set THT=coll
52@echo.
53@echo ==== %THT% =========================================================================
54%SAMPLE_COLL%
55if ERRORLEVEL 1 goto :SampleError
56
57@set THT=strsrch
58@echo.
59@echo ==== %THT% =========================================================================
60%SAMPLE_STRSRCH%
61if ERRORLEVEL 1 goto :SampleError
62
63@set THT=translit
64@echo.
65@echo ==== %THT% =========================================================================
66%SAMPLE_TRANSLIT%
67if ERRORLEVEL 1 goto :SampleError
68
69@set THT=ugrep
70@echo.
71@echo ==== %THT% =========================================================================
72echo Looking for "ICU" in '%ICU_SAMPLESDIR%\ugrep\readme.txt' with ugrep.exe
73%SAMPLE_UGREP% ICU %ICU_SAMPLESDIR%\ugrep\readme.txt
74if ERRORLEVEL 1 goto :SampleError
75
76
77
78rem All done
79goto :QuitWithNoError
80
81:SampleError
82 echo.
83 echo ERROR: Sample program %THT% did not exit cleanly. Stopping execution.
84 echo.
85 goto :QuitWithError
86
87:QuitWithNoError
88 echo.
89 popd
90 exit /b 0
91
92:QuitWithError
93 echo.
94 popd
95 rem Exit with non-zero error code.
96 exit /b 1
97