Imported Upstream version 58.1
[platform/upstream/icu.git] / source / test / perf / utfperf / UtfPerf.pl
1 #!/usr/bin/perl
2 #  ********************************************************************
3 #  * Copyright (C) 2016 and later: Unicode, Inc. and others.
4 #  * License & terms of use: http://www.unicode.org/copyright.html#License
5 #  ********************************************************************
6 #  ********************************************************************
7 #  * COPYRIGHT:
8 #  * Copyright (c) 2005-2013, International Business Machines Corporation and
9 #  * others. All Rights Reserved.
10 #  ********************************************************************
11
12 #use strict;
13
14 require "../perldriver/Common.pl";
15
16 use lib '../perldriver';
17
18 use PerfFramework;
19
20 my $options = {
21     "title"=>"UTF performance: ICU (".$ICUPreviousVersion." and ".$ICULatestVersion.")",
22     "headers"=>"ICU".$ICUPreviousVersion." ICU".$ICULatestVersion,
23     "operationIs"=>"gb18030 encoding string",
24     "passes"=>"1",
25     "time"=>"2",
26     #"outputType"=>"HTML",
27     "dataDir"=>$ConversionDataPath,
28     "outputDir"=>"../results"
29 };
30
31 # programs
32 # tests will be done for all the programs. Results will be stored and connected
33 my $p1;
34 my $p2;
35
36 if ($OnWindows) {
37     $p1 = "cd ".$ICUPrevious."/bin && ".$ICUPathPrevious."/utfperf/$WindowsPlatform/Release/utfperf.exe -e gb18030"; # Previous
38     $p2 = "cd ".$ICULatest."/bin && ".$ICUPathLatest."/utfperf/$WindowsPlatform/Release/utfperf.exe -e gb18030"; # Latest
39 } else {
40     $p1 = "LD_LIBRARY_PATH=".$ICUPrevious."/source/lib:".$ICUPrevious."/source/tools/ctestfw ".$ICUPathPrevious."/utfperf/utfperf -e gb18030"; # Previous
41     $p2 = "LD_LIBRARY_PATH=".$ICULatest."/source/lib:".$ICULatest."/source/tools/ctestfw ".$ICUPathLatest."/utfperf/utfperf -e gb18030"; # Latest
42 }
43
44 my $tests = { 
45     "Roundtrip",      ["$p1,Roundtrip",        "$p2,Roundtrip"],
46     "FromUnicode",    ["$p1,FromUnicode",      "$p2,FromUnicode"],
47     "FromUTF8",       ["$p1,FromUTF8",         "$p2,FromUTF8"],
48 };
49
50 my $dataFiles = {
51     "", ["xuzhimo.txt"]
52 };
53
54 runTests($options, $tests, $dataFiles);