-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
187 changed files
with
617 additions
and
419 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
bin/ | ||
obj/ | ||
|
||
!/bin | ||
|
||
# IDE files | ||
.vs/ | ||
.vscode/ | ||
|
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,44 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
# Synopsis: | ||
# Run the test runner on a solution using the test runner Docker image. | ||
# The test runner Docker image is built automatically. | ||
|
||
# Arguments: | ||
# $1: exercise slug | ||
# $2: path to solution folder | ||
# $3: path to output directory | ||
|
||
# Output: | ||
# Writes the test results to a results.json file in the passed-in output directory. | ||
# The test results are formatted according to the specifications at https://github.com/exercism/docs/blob/main/building/tooling/test-runners/interface.md | ||
|
||
# Example: | ||
# ./bin/run-in-docker.sh two-fer path/to/solution/folder/ path/to/output/directory/ | ||
|
||
# If any required arguments is missing, print the usage and exit | ||
if [ "$#" -lt 3 ]; then | ||
echo "usage: ./bin/run-in-docker.sh exercise-slug path/to/solution/folder/ path/to/output/directory/" | ||
exit 1 | ||
fi | ||
|
||
slug="$1" | ||
solution_dir=$(realpath "${2%/}") | ||
output_dir=$(realpath "${3%/}") | ||
|
||
# Create the output directory if it doesn't exist | ||
mkdir -p "${output_dir}" | ||
|
||
# Build the Docker image | ||
docker build --rm -t exercism/csharp-test-runner . | ||
|
||
# Run the Docker image using the settings mimicking the production environment | ||
docker run \ | ||
--rm \ | ||
--network none \ | ||
--read-only \ | ||
--mount type=bind,src="${solution_dir}",dst=/solution \ | ||
--mount type=bind,src="${output_dir}",dst=/output \ | ||
--mount type=tmpfs,dst=/tmp \ | ||
exercism/csharp-test-runner "${slug}" /solution /output |
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 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
# Synopsis: | ||
# Test the test runner Docker image by running it against a predefined set of | ||
# solutions with an expected output. | ||
# The test runner Docker image is built automatically. | ||
|
||
# Output: | ||
# Outputs the diff of the expected test results against the actual test results | ||
# generated by the test runner Docker image. | ||
|
||
# Example: | ||
# ./bin/run-tests-in-docker.sh | ||
|
||
# Build the Docker image | ||
docker build --rm -t exercism/csharp-test-runner . | ||
|
||
# Run the Docker image using the settings mimicking the production environment | ||
docker run \ | ||
--rm \ | ||
--network none \ | ||
--read-only \ | ||
--mount type=bind,src="${PWD}/tests",dst=/opt/test-runner/tests \ | ||
--mount type=tmpfs,dst=/tmp \ | ||
--volume "${PWD}/bin/run-tests.sh:/opt/test-runner/bin/run-tests.sh" \ | ||
--workdir /opt/test-runner \ | ||
--entrypoint /opt/test-runner/bin/run-tests.sh \ | ||
exercism/csharp-test-runner |
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,33 @@ | ||
#!/usr/bin/env sh | ||
|
||
# Synopsis: | ||
# Test the test runner by running it against a predefined set of solutions | ||
# with an expected output. | ||
|
||
# Output: | ||
# Outputs the diff of the expected test results against the actual test results | ||
# generated by the test runner. | ||
|
||
# Example: | ||
# ./bin/run-tests.sh | ||
|
||
exit_code=0 | ||
|
||
# Iterate over all test directories | ||
for test_dir in tests/*; do | ||
test_dir_name=$(basename "${test_dir}") | ||
test_dir_path=$(realpath "${test_dir}") | ||
results_file_path="${test_dir_path}/results.json" | ||
expected_results_file_path="${test_dir_path}/expected_results.json" | ||
|
||
bin/run.sh "${test_dir_name}" "${test_dir_path}" "${test_dir_path}" | ||
|
||
echo "${test_dir_name}: comparing results.json to expected_results.json" | ||
diff "${results_file_path}" "${expected_results_file_path}" | ||
|
||
if [ $? -ne 0 ]; then | ||
exit_code=1 | ||
fi | ||
done | ||
|
||
exit ${exit_code} |
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,28 @@ | ||
#!/usr/bin/env sh | ||
|
||
# Synopsis: | ||
# Run the test runner on a solution. | ||
|
||
# Arguments: | ||
# $1: exercise slug | ||
# $2: path to solution folder | ||
# $3: path to output directory | ||
|
||
# Output: | ||
# Writes the test results to a results.json file in the passed-in output directory. | ||
# The test results are formatted according to the specifications at https://github.com/exercism/docs/blob/main/building/tooling/test-runners/interface.md | ||
|
||
# Example: | ||
# ./bin/run.sh two-fer path/to/solution/folder/ path/to/output/directory/ | ||
|
||
# If any required arguments is missing, print the usage and exit | ||
if [ "$#" -lt 3 ]; then | ||
echo "usage: ./bin/run.sh exercise-slug path/to/solution/folder/ path/to/output/directory/" | ||
exit 1 | ||
fi | ||
|
||
if [ -f /opt/test-runner/Exercism.TestRunner.CSharp ]; then | ||
/opt/test-runner/Exercism.TestRunner.CSharp $1 $2 $3 | ||
else | ||
dotnet run --project ./src/Exercism.TestRunner.CSharp/ $1 $2 $3 | ||
fi |
6 changes: 1 addition & 5 deletions
6
src/Exercism.TestRunner.CSharp/Exercism.TestRunner.CSharp.csproj
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
11 changes: 0 additions & 11 deletions
11
...cism.TestRunner.CSharp.IntegrationTests/Solutions/DotnetFiveProject/expected_results.json
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestClassesWithAllPasses/Fake.csproj
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...rcism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithAllPasses/Fake.csproj
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...m.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithMultipleFails/Fake.csproj
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...cism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithSingleFail/Fake.csproj
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...cism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutput/Fake.csproj
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...r.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutputExceedingLimit/Fake.csproj
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.