This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MXNET-1155] Add scala packageTest utility
- Loading branch information
Showing
13 changed files
with
445 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
SCALA_VERSION_PROFILE := 2.11 | ||
SCALA_VERSION := 2.11.8 | ||
MXNET_VERSION := 1.3.1-SNAPSHOT | ||
|
||
MXNET_REPO = https://repository.apache.org/content/repositories/snapshots | ||
|
||
ifeq ($(OS),Windows_NT) | ||
UNAME_S := Windows | ||
else | ||
UNAME_S := $(shell uname -s) | ||
endif | ||
|
||
ifeq ($(UNAME_S), Windows) | ||
# TODO: currently scala package does not support windows | ||
SCALA_PKG_PROFILE := windows | ||
else | ||
ifeq ($(UNAME_S), Darwin) | ||
SCALA_PKG_PROFILE := osx-x86_64-cpu | ||
else | ||
SCALA_PKG_PROFILE := linux-x86_64 | ||
ifeq ($(USE_CUDA), 1) | ||
SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-gpu | ||
else | ||
SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-cpu | ||
endif | ||
endif | ||
endif | ||
|
||
scalapkg: | ||
(mvn package -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ | ||
-Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE) \ | ||
-Dmxnet.version=$(MXNET_VERSION) \ | ||
-Dscala.version=$(SCALA_VERSION)) | ||
|
||
scalaclean: | ||
(mvn clean -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ | ||
-Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE) \ | ||
-Dmxnet.version=$(MXNET_VERSION) \ | ||
-Dscala.version=$(SCALA_VERSION)) | ||
|
||
scalaintegrationtest: | ||
(mvn integration-test -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ | ||
-PwithExamples \ | ||
-Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE) \ | ||
-Dmxnet.version=$(MXNET_VERSION) \ | ||
-Dscala.version=$(SCALA_VERSION)) | ||
|
||
scalaintegrationtestsnapshot: | ||
(mvn integration-test -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ | ||
-PfromSnapshots \ | ||
-Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE) \ | ||
-Dmxnet.repo=$(MXNET_REPO) \ | ||
-Dmxnet.version=$(MXNET_VERSION) \ | ||
-Dscala.version=$(SCALA_VERSION)) | ||
|
||
scalaintegrationtestwithoutexamples: | ||
(mvn integration-test -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ | ||
-Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE) \ | ||
-Dmxnet.version=$(MXNET_VERSION) \ | ||
-Dscala.version=$(SCALA_VERSION)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# MXNet Scala Package Test | ||
|
||
This is an project created to run the test suite on a fully packaged mxnet jar. | ||
|
||
## Setup | ||
|
||
### Install Package | ||
|
||
To run the test suite, first install the package. This can be done either by installing directly from a jar with `mvn install:install-file -Dfile=<path-to-file>` or by running `make scalainstall` in the main mxnet folder. Note that if you use `mvn install:install-file`, you will be unable to run the example tests unless you also install the mxnetexamples jar. You can run all tests except for those examples with `make scalaintegrationtestwithoutexamples`. | ||
|
||
### Build | ||
|
||
Build the mxnet tests by running `make scalapkg` and then `make scalatestcompile` from the main mxnet directory. This is needed for test discovery. | ||
|
||
## Run | ||
|
||
To run, ensure the versions are correct in the `Makefile`. Then, just run `make scalaintegrationtest` to execute the test suite | ||
|
||
## Clean | ||
|
||
You can clean temporary files and target artifacts by running `make scalaclean`. | ||
|
||
## Troubleshooting | ||
|
||
### Missing Examples | ||
|
||
If you fail with the following error | ||
``` | ||
[ERROR] Failed to execute goal org.scalatest:scalatest-maven-plugin:1.0:test (test) on project mxnet-scala-packagetest-examples_2.11: There are test failures -> [Help 1] | ||
[ERROR] | ||
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. | ||
[ERROR] Re-run Maven using the -X switch to enable full debug logging. | ||
[ERROR] | ||
[ERROR] For more information about the errors and possible solutions, please read the following articles: | ||
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException | ||
[ERROR] | ||
[ERROR] After correcting the problems, you can resume the build with the command | ||
[ERROR] mvn <goals> -rf :mxnet-scala-packagetest-examples_2.11 | ||
Makefile:57: recipe for target 'scalaintegrationtest' failed | ||
make: *** [scalaintegrationtest] Error 1 | ||
``` | ||
|
||
and stacktrace begins with the following, | ||
|
||
``` | ||
*** RUN ABORTED *** | ||
java.lang.NoClassDefFoundError: org/apache/mxnetexamples/Util$ | ||
``` | ||
|
||
you are missing the mxnetexamples package. See the "Install Package" section for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?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> | ||
<parent> | ||
<groupId>PackageTest</groupId> | ||
<artifactId>mxnet-scala-packagetest_2.11</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>mxnet-scala-packagetest-core_2.11</artifactId> | ||
<name>MXNet Scala Package Test</name> | ||
<packaging>pom</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.scalatest</groupId> | ||
<artifactId>scalatest-maven-plugin</artifactId> | ||
<version>1.0</version> | ||
<configuration> | ||
<runpath>${project.build.outputDirectory},${project.build.testOutputDirectory},../../core/target/test-classes</runpath> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../core/scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?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> | ||
<parent> | ||
<groupId>PackageTest</groupId> | ||
<artifactId>mxnet-scala-packagetest_2.11</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>mxnet-scala-packagetest-examples_2.11</artifactId> | ||
<name>MXNet Scala Package Test</name> | ||
<packaging>pom</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.scalatest</groupId> | ||
<artifactId>scalatest-maven-plugin</artifactId> | ||
<version>1.0</version> | ||
<configuration> | ||
<runpath>${project.build.outputDirectory},${project.build.testOutputDirectory},../../examples/target/test-classes</runpath> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.mxnet</groupId> | ||
<artifactId>mxnet-examples_${mxnet.scalaprofile}</artifactId> | ||
<version>${mxnet.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../examples/scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?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> | ||
<parent> | ||
<groupId>PackageTest</groupId> | ||
<artifactId>mxnet-scala-packagetest_2.11</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>mxnet-scala-packagetest-infer_2.11</artifactId> | ||
<name>MXNet Scala Package Test</name> | ||
<packaging>pom</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.scalatest</groupId> | ||
<artifactId>scalatest-maven-plugin</artifactId> | ||
<version>1.0</version> | ||
<configuration> | ||
<runpath>${project.build.outputDirectory},${project.build.testOutputDirectory},../../infer/target/test-classes</runpath> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.