Skip to content

Commit

Permalink
Add ICU4J executor skeleton implementation (unicode-org#134)
Browse files Browse the repository at this point in the history
* Create executor for ICU4J 73

* Add `ignore` option to TestPlan to allow an executor instance to be skipped

* Add config for skeleton impl of icu4j executor in ignored mode (no-op)

* Fix bug related to options parsing / default value handling
  • Loading branch information
echeran authored Nov 22, 2023
1 parent 12e4f0d commit c202ef1
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 11 deletions.
82 changes: 82 additions & 0 deletions executors/icu4j/73/executor-icu4j/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.unicode.conformance</groupId>
<artifactId>executor-icu4j</artifactId>
<version>1.0-SNAPSHOT</version>

<name>executor-icu4j</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>

<!-- JSON library -->
<plugin>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.unicode.conformance;

/**
* Hello world!
*
*/
public class Icu4jExecutor
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.unicode.conformance;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
* Unit test for simple App.
*/
public class Icu4jExecutorTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}
3 changes: 2 additions & 1 deletion generateDataAndRun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ jq -c '.[]' ../$source_file | while read i; do
exec_command=$(jq -r -c '.run.exec' <<< $i)
test_type=$(jq -r -c '.run.test_type | join(" ")' <<< $i)
per_execution=$(jq -r -c '.run.per_execution' <<< $i)
python3 testdriver.py --icu_version $icu_version --exec $exec_command --test_type $test_type --file_base ../$TEMP_DIR --per_execution $per_execution
ignore=$(jq -r -c '.run.ignore' <<< $i)
python3 testdriver.py --icu_version $icu_version --exec $exec_command --test_type $test_type --file_base ../$TEMP_DIR --per_execution $per_execution --ignore $ignore
echo $?
done

Expand Down
13 changes: 12 additions & 1 deletion run_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,16 @@
],
"per_execution": 10000
}
}
},
{
"run": {
"icu_version": "icu73",
"exec": "icu4j",
"test_type": [
"collation_short"
],
"per_execution": 10000,
"ignore": true
}
}
]
24 changes: 18 additions & 6 deletions testdriver/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from enum import Enum

import sys
import logging
import logging.config


# Describes dataset and its versions.
Expand All @@ -22,6 +24,8 @@ def __init__(self, test_type, testDataFilename, verifyFilename,
self.status = None
self.debug = False

logging.config.fileConfig("../logging.conf")


def dataSetsForCldr(dataSets, cldr_version):
# get all those datasets for a given CLDR version
Expand Down Expand Up @@ -151,7 +155,7 @@ class ExecutorLang(Enum):
NODE = "node"
RUST = "rust"
CPP = "cpp"
JAVA = "java"
ICU4J = "icu4j"
DARTWEB = "dart_web"
DARTNATIVE = "dart_native"

Expand All @@ -162,7 +166,7 @@ class ExecutorLang(Enum):
"dart_native" : "../executors/dart_native/bin/executor.exe",
"rust" : "../executors/rust/target/release/executor",
"cpp": "../executors/cpp/executor",
"java" : None
"icu4j" : "mvn -f ../executors/icu4j/73/executor-icu4j/pom.xml compile exec:java -Dexec.mainClass=org.unicode.conformance.Icu4jExecutor"
}

class ParallelMode(Enum):
Expand Down Expand Up @@ -214,7 +218,9 @@ class ICU4XVersion(Enum):
},
'dart': {},
'icu4c': {},
'icu4j': {},
'icu4j': {
'73': ['73']
},

}
# What versions of NodeJS use specific ICU versions
Expand Down Expand Up @@ -286,8 +292,8 @@ def versionForCldr(self, lang, cldr_needed):
return {'path': lang} # Nothing found

def has(self, exec) :
if self.debug:
print('HAS %s in %s' % (exec, (self.systems.keys())))
logging.debug('HAS %s in %s', exec, (self.systems.keys()))

try:
return exec in self.systems
except KeyError:
Expand Down Expand Up @@ -352,7 +358,11 @@ def has(self, exec) :
CLDRVersion.CLDR41, versionICU=ICUVersion.ICU71,
argList=['argA', 'argB', 'argZ'])

system = ExecutorLang.JAVA
system = ExecutorLang.ICU4J.value

allExecutors.addSystem(system, '73',
'mvn -f ../executors/icu4j/73/executor-icu4j/pom.xml compile exec:java -Dexec.mainClass=org.unicode.conformance.Icu4jExecutor',
CLDRVersion.CLDR43, versionICU=ICUVersion.ICU73)

system = ExecutorLang.DARTWEB.value
allExecutors.addSystem(system, NodeVersion.Node19,
Expand Down Expand Up @@ -397,6 +407,8 @@ def printCldrIcuMap():

def main(args):

logging.config.fileConfig("../logging.conf")

printCldrIcuMap()
print()
printDatasets(testDatasets)
Expand Down
2 changes: 2 additions & 0 deletions testdriver/ddtargs.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def setCommonArgs(parser):

parser.add_argument('--debug_level', default=None)

parser.add_argument('--ignore', default=None)

def argsTestData():
tests = [
['--test_type', 'collation_short'],
Expand Down
7 changes: 4 additions & 3 deletions testdriver/testdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ def set_args(self, arg_options):
# Run a non-specified executor. Compatibility of versions
# between test data and the executor should be done the text executor
# program itself.
if self.debug:
logging.info('!!! **** CUSTOM EXEC = %s', executor)
logging.error('No executable command configured for executor platform: %s', executor)
exec_command = {'path': executor}
else:
# Set details for execution from ExecutorInfo
resolved_cldr_version = ddt_data.resolveCldr(self.cldrVersion)
exec_command = ddt_data.allExecutors.versionForCldr(
executor, resolved_cldr_version)
# The command needs to be something else!

new_plan = TestPlan(exec_command, test_type)
new_plan.set_options(arg_options)
new_plan.test_lang = executor.split()[0]
Expand All @@ -71,7 +71,8 @@ def set_args(self, arg_options):
except KeyError as err:
logging.warning('!!! %s: No test data filename for %s', err, test_type)

self.test_plans.append(new_plan)
if not new_plan.ignore:
self.test_plans.append(new_plan)

def parse_args(self, args):
# TODO: handle arguments for:
Expand Down
6 changes: 6 additions & 0 deletions testdriver/testplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def __init__(self, exec_data, test_type, args=None):
self.options = None
self.testData = None

# Ignore this TestPlan. In other words, do not run
self.ignore = None

# Additional args to subprocess.run
self.args = args

Expand Down Expand Up @@ -63,6 +66,9 @@ def set_options(self, options):
except KeyError:
logging.warning('NO ICU VERSION SET')

if options.ignore and not options.ignore == "null":
self.ignore = True

def set_test_data(self, test_data):
self.testData = test_data # ???['tests']

Expand Down

0 comments on commit c202ef1

Please sign in to comment.