-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unit-tests for Joda convert. #45
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test | ||
# | ||
# Licensed 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. | ||
|
||
set -v | ||
rm -rf test-repo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this just be "repo" instead of "test-repo"? Though it's used for testing, it is just a copy of the repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this script is currently called prep-tests.sh, and there is no requirement that the repo one specifies to this script have anything but unit tests. if we generalize this script to handle main source set later, then we should rename. |
||
rm -rf src/test | ||
rm -rf src | ||
|
||
set -ev | ||
TAG=$1 | ||
REPO=$2 | ||
TEST_DIR_IN_REPO=$3 | ||
git clone --depth 1 --branch $TAG $REPO test-repo | ||
mkdir src | ||
cp -R test-repo/$TEST_DIR_IN_REPO src/test |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test | ||
# | ||
# Licensed 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. | ||
|
||
../../common/prep-tests.sh v1.8 https://github.com/JodaOrg/joda-convert src/test |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,8 @@ | |
# Fail if anything fails. | ||
set -ev | ||
|
||
./run-test.sh com.google.code.gson-gson | ||
./run-test.sh org.joda-joda-convert | ||
./run-test.sh joda-time-joda-time | ||
./run-test.sh org.joda-joda-primitives | ||
./run-test.sh org.apache.commons-commons-lang3 | ||
./run-test.sh com.google.code.gson-gson build | ||
./run-test.sh org.joda-joda-convert build | ||
./run-test.sh joda-time-joda-time build | ||
./run-test.sh org.joda-joda-primitives build | ||
./run-test.sh org.apache.commons-commons-lang3 build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drop the "build" and just assume it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed this functionality from this PR (see above) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,26 @@ | |
set -ev | ||
|
||
TEST_DIR=$1 | ||
echo Running test $TEST_DIR | ||
pushd $TEST_DIR | ||
|
||
echo Preparing test $TEST_DIR | ||
|
||
# Execute the prep.sh files within this project, if any. | ||
# These are often used to retrieve test sources for the libraries. | ||
# -L follows symbolic links correctly. | ||
find -L . -name prep.sh | while read PREP_SCRIPT_FILE | ||
do | ||
pushd `dirname $PREP_SCRIPT_FILE` | ||
sh prep.sh | ||
popd | ||
done | ||
|
||
echo Running test $TEST_DIR | ||
./gradlew wrapper | ||
./gradlew clean | ||
./gradlew build | ||
# 2nd through last arguments are the gradle tasks to test. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you doing this? It would allow you to control what tasks you're running but you're not including an example of that. At the very least, please explain what this is for. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed this functionality from this PR (see above) |
||
for task in "${@:2}"; do | ||
./gradlew $task --stacktrace | ||
done | ||
./gradlew assemble | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to do "assemble" before the "build" or other testing tasks. That way, we can more easily distinguish between code that can be used (assemble task) and code that's tested (build task). |
||
popd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is repeated, it's boiler plate that can be removed ;-)
For now assume that all libraries run the build task for testing. I think that's a good assumption anyway.
If it needs something else in the future, then enumerate the exceptions, not the standard way of operating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd had a plan to allow 2 entries for a TEST_DIR:
this would allow you to have unit tests in the allowed failures but have translation/compilation in the required successes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either way, i'm removing these changes from this PR as it is only needed in gson, not Joda.