From f1a08130ffcaf43dbb94fd2d23698ec0c716108c Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 08:00:20 +0200 Subject: [PATCH 01/29] Change to coveralls --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5a784ae..268173a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ulimit -n 2048; fi install: - dotnet tool install -g dotnet-format --version 4.0.40103 --add-source https://dotnet.myget.org/F/format/api/v3/index.json + - dotnet tool install -g coveralls.net --version 1.0.0 - export PATH="$PATH:$HOME/.dotnet/tools" - dotnet-format --version before_script: @@ -31,4 +32,5 @@ script: - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - - bash <(curl -s https://codecov.io/bash) + - #bash <(curl -s https://codecov.io/bash) + - dotnet csmacnz.coveralls --opencover -i coverage.xml --useRelativePaths From db5b4674ab3c0ee021d17a48a5df165dda0a5091 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 08:05:18 +0200 Subject: [PATCH 02/29] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 268173a..b065bd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,4 +33,4 @@ script: after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - #bash <(curl -s https://codecov.io/bash) - - dotnet csmacnz.coveralls --opencover -i coverage.xml --useRelativePaths + - ./csmacnz.coveralls.exe --opencover -i coverage.xml --useRelativePaths From 9122eee97aff264b0e64271beec4273c23de00ea Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 08:12:32 +0200 Subject: [PATCH 03/29] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b065bd4..88d4df4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,4 +33,4 @@ script: after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - #bash <(curl -s https://codecov.io/bash) - - ./csmacnz.coveralls.exe --opencover -i coverage.xml --useRelativePaths + - ./csmacnz.coveralls --opencover -i coverage.xml --useRelativePaths From 1aa3ead2fdd02c66ba965b333de9532d7b3f259c Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 08:24:03 +0200 Subject: [PATCH 04/29] Update .travis.yml --- .travis.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 88d4df4..2ead871 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,4 +33,15 @@ script: after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - #bash <(curl -s https://codecov.io/bash) - - ./csmacnz.coveralls --opencover -i coverage.xml --useRelativePaths + - REPO_COMMIT_AUTHOR=$(git show -s --pretty=format:"%cn") + - REPO_COMMIT_AUTHOR_EMAIL=$(git show -s --pretty=format:"%ce") + - REPO_COMMIT_MESSAGE=$(git show -s --pretty=format:"%s") + - echo $TRAVIS_COMMIT + - echo $TRAVIS_BRANCH + - echo $REPO_COMMIT_AUTHOR + - echo $REPO_COMMIT_AUTHOR_EMAIL + - echo $REPO_COMMIT_MESSAGE + - echo $TRAVIS_JOB_ID + - ls -la /.dotnet/tools + - ./.dotnet/tools/csmacnz.coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --commitAuthor "$REPO_COMMIT_AUTHOR" --commitEmail "$REPO_COMMIT_AUTHOR_EMAIL" --commitMessage "$REPO_COMMIT_MESSAGE" --jobId $TRAVIS_JOB_ID --serviceName travis-ci --useRelativePaths + From f35956b5dbb42b9495415674a47fa9f9ae1cdfc7 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 08:29:44 +0200 Subject: [PATCH 05/29] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2ead871..8ca406b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ install: - dotnet tool install -g dotnet-format --version 4.0.40103 --add-source https://dotnet.myget.org/F/format/api/v3/index.json - dotnet tool install -g coveralls.net --version 1.0.0 - export PATH="$PATH:$HOME/.dotnet/tools" + - ls -la $HOME/.dotnet/tools - dotnet-format --version before_script: - echo "Checking format ..." @@ -42,6 +43,5 @@ after_success: - echo $REPO_COMMIT_AUTHOR_EMAIL - echo $REPO_COMMIT_MESSAGE - echo $TRAVIS_JOB_ID - - ls -la /.dotnet/tools - - ./.dotnet/tools/csmacnz.coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --commitAuthor "$REPO_COMMIT_AUTHOR" --commitEmail "$REPO_COMMIT_AUTHOR_EMAIL" --commitMessage "$REPO_COMMIT_MESSAGE" --jobId $TRAVIS_JOB_ID --serviceName travis-ci --useRelativePaths + - ./$HOME/.dotnet/tools/csmacnz.coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --commitAuthor "$REPO_COMMIT_AUTHOR" --commitEmail "$REPO_COMMIT_AUTHOR_EMAIL" --commitMessage "$REPO_COMMIT_MESSAGE" --jobId $TRAVIS_JOB_ID --serviceName travis-ci --useRelativePaths From dd56fa66d8358bf0ccf08d3202cf06797ab4879a Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 08:33:03 +0200 Subject: [PATCH 06/29] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8ca406b..4a37598 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,5 +43,5 @@ after_success: - echo $REPO_COMMIT_AUTHOR_EMAIL - echo $REPO_COMMIT_MESSAGE - echo $TRAVIS_JOB_ID - - ./$HOME/.dotnet/tools/csmacnz.coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --commitAuthor "$REPO_COMMIT_AUTHOR" --commitEmail "$REPO_COMMIT_AUTHOR_EMAIL" --commitMessage "$REPO_COMMIT_MESSAGE" --jobId $TRAVIS_JOB_ID --serviceName travis-ci --useRelativePaths + - ./$HOME/.dotnet/tools/csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --commitAuthor "$REPO_COMMIT_AUTHOR" --commitEmail "$REPO_COMMIT_AUTHOR_EMAIL" --commitMessage "$REPO_COMMIT_MESSAGE" --jobId $TRAVIS_JOB_ID --serviceName travis-ci --useRelativePaths From bbdca9e6c984df97fd2f184e3efb524c7d24d6f1 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 08:36:57 +0200 Subject: [PATCH 07/29] Update .travis.yml --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4a37598..71d7cae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,6 @@ install: - dotnet tool install -g dotnet-format --version 4.0.40103 --add-source https://dotnet.myget.org/F/format/api/v3/index.json - dotnet tool install -g coveralls.net --version 1.0.0 - export PATH="$PATH:$HOME/.dotnet/tools" - - ls -la $HOME/.dotnet/tools - dotnet-format --version before_script: - echo "Checking format ..." @@ -43,5 +42,5 @@ after_success: - echo $REPO_COMMIT_AUTHOR_EMAIL - echo $REPO_COMMIT_MESSAGE - echo $TRAVIS_JOB_ID - - ./$HOME/.dotnet/tools/csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --commitAuthor "$REPO_COMMIT_AUTHOR" --commitEmail "$REPO_COMMIT_AUTHOR_EMAIL" --commitMessage "$REPO_COMMIT_MESSAGE" --jobId $TRAVIS_JOB_ID --serviceName travis-ci --useRelativePaths + - csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --commitAuthor "$REPO_COMMIT_AUTHOR" --commitEmail "$REPO_COMMIT_AUTHOR_EMAIL" --commitMessage "$REPO_COMMIT_MESSAGE" --jobId $TRAVIS_JOB_ID --serviceName travis-ci --useRelativePaths From 8fcbd98abb10f6fd60c9cb955bb56ee16cbd9706 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 08:42:47 +0200 Subject: [PATCH 08/29] Update .travis.yml --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 71d7cae..f9626bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ install: - dotnet tool install -g coveralls.net --version 1.0.0 - export PATH="$PATH:$HOME/.dotnet/tools" - dotnet-format --version + - csmacnz.Coveralls --version before_script: - echo "Checking format ..." - dotnet format --check --dry-run -w src/TuringMachine -v diagnostic @@ -42,5 +43,5 @@ after_success: - echo $REPO_COMMIT_AUTHOR_EMAIL - echo $REPO_COMMIT_MESSAGE - echo $TRAVIS_JOB_ID - - csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --commitAuthor "$REPO_COMMIT_AUTHOR" --commitEmail "$REPO_COMMIT_AUTHOR_EMAIL" --commitMessage "$REPO_COMMIT_MESSAGE" --jobId $TRAVIS_JOB_ID --serviceName travis-ci --useRelativePaths + - csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --useRelativePaths From 7a2a888084d0d22aa4b3b7f936cd26a72b343fbc Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 08:49:45 +0200 Subject: [PATCH 09/29] Update .travis.yml --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f9626bf..3f1dbf9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ script: - cd tests/TuringMachine.Core.Tests - dotnet restore - find * -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild - - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=coverage.xml after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - #bash <(curl -s https://codecov.io/bash) @@ -43,5 +43,6 @@ after_success: - echo $REPO_COMMIT_AUTHOR_EMAIL - echo $REPO_COMMIT_MESSAGE - echo $TRAVIS_JOB_ID - - csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --useRelativePaths + - ls -la . + - csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --useRelativePaths --serviceName travis-ci --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH From 18b634ccb8e611b9e8391b8f3ce88118818fc218 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 08:57:47 +0200 Subject: [PATCH 10/29] Update .travis.yml --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f1dbf9..43f9c3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,6 +43,5 @@ after_success: - echo $REPO_COMMIT_AUTHOR_EMAIL - echo $REPO_COMMIT_MESSAGE - echo $TRAVIS_JOB_ID - - ls -la . - - csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --useRelativePaths --serviceName travis-ci --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH + - csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --useRelativePaths --serviceName travis-ci --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID From b305b6f563dc38f41e8f7fafb6f938f6aa17f68e Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 09:05:46 +0200 Subject: [PATCH 11/29] Update .travis.yml --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43f9c3b..f1ae620 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,14 +34,14 @@ script: after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - #bash <(curl -s https://codecov.io/bash) - - REPO_COMMIT_AUTHOR=$(git show -s --pretty=format:"%cn") - - REPO_COMMIT_AUTHOR_EMAIL=$(git show -s --pretty=format:"%ce") - - REPO_COMMIT_MESSAGE=$(git show -s --pretty=format:"%s") + - #REPO_COMMIT_AUTHOR=$(git show -s --pretty=format:"%cn") + - #REPO_COMMIT_AUTHOR_EMAIL=$(git show -s --pretty=format:"%ce") + - #REPO_COMMIT_MESSAGE=$(git show -s --pretty=format:"%s") + - #echo $REPO_COMMIT_AUTHOR + - #echo $REPO_COMMIT_AUTHOR_EMAIL + - #echo $REPO_COMMIT_MESSAGE - echo $TRAVIS_COMMIT - echo $TRAVIS_BRANCH - - echo $REPO_COMMIT_AUTHOR - - echo $REPO_COMMIT_AUTHOR_EMAIL - - echo $REPO_COMMIT_MESSAGE - echo $TRAVIS_JOB_ID - - csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --useRelativePaths --serviceName travis-ci --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID + - csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID From 5be62d45ff54d78ad0a6d8076a0cb8e70ac230fc Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 09:11:14 +0200 Subject: [PATCH 12/29] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f1ae620..2ca8265 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,5 +43,5 @@ after_success: - echo $TRAVIS_COMMIT - echo $TRAVIS_BRANCH - echo $TRAVIS_JOB_ID - - csmacnz.Coveralls --opencover -i coverage.xml --repoToken $COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths From bfbb119c95f8ef08721af1ad66671a2e263b19fd Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 09:17:24 +0200 Subject: [PATCH 13/29] Update .travis.yml --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2ca8265..b036ca8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,4 +44,9 @@ after_success: - echo $TRAVIS_BRANCH - echo $TRAVIS_JOB_ID - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --basePath ../.././ + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --basePath ../../ + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --basePath ../ + From 02dc8a8f0e71ee8a034dab8868d16c14952714bb Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 09:32:19 +0200 Subject: [PATCH 14/29] Update .travis.yml --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index b036ca8..2a0a7d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,10 +43,6 @@ after_success: - echo $TRAVIS_COMMIT - echo $TRAVIS_BRANCH - echo $TRAVIS_JOB_ID - - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths - - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN - - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --basePath ../.././ - - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --basePath ../../ - - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --basePath ../ + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --basePath ../../src/TuringMachine.Core/ From 8c2e9f9caf2a6cffd01f9e34a0703e6f5c0a5704 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 09:33:58 +0200 Subject: [PATCH 15/29] Update .travis.yml --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2a0a7d3..746681b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,6 +43,5 @@ after_success: - echo $TRAVIS_COMMIT - echo $TRAVIS_BRANCH - echo $TRAVIS_JOB_ID - - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --basePath ../../src/TuringMachine.Core/ - - + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --basePath ../../src/TuringMachine.Core/ --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID + From c91e0ff3a25dff444801e03ca044ecbe1d8ec3bd Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 09:39:07 +0200 Subject: [PATCH 16/29] Update .travis.yml --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 746681b..1d6f30d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ script: - cd tests/TuringMachine.Core.Tests - dotnet restore - find * -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild - - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=coverage.xml + - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../src/TuringMachine.Core/coverage.xml' after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - #bash <(curl -s https://codecov.io/bash) @@ -43,5 +43,6 @@ after_success: - echo $TRAVIS_COMMIT - echo $TRAVIS_BRANCH - echo $TRAVIS_JOB_ID - - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --basePath ../../src/TuringMachine.Core/ --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID + - cd ../../src/TuringMachine.Core/ + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID From 27bf13625d3b3f708fb688f11cce6981dfb25f4d Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 09:45:38 +0200 Subject: [PATCH 17/29] Update .travis.yml --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1d6f30d..1faf7a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,13 +36,11 @@ after_success: - #bash <(curl -s https://codecov.io/bash) - #REPO_COMMIT_AUTHOR=$(git show -s --pretty=format:"%cn") - #REPO_COMMIT_AUTHOR_EMAIL=$(git show -s --pretty=format:"%ce") - - #REPO_COMMIT_MESSAGE=$(git show -s --pretty=format:"%s") - #echo $REPO_COMMIT_AUTHOR - #echo $REPO_COMMIT_AUTHOR_EMAIL - - #echo $REPO_COMMIT_MESSAGE + - echo $TRAVIS_COMMIT_MESSAGE - echo $TRAVIS_COMMIT - echo $TRAVIS_BRANCH - echo $TRAVIS_JOB_ID - cd ../../src/TuringMachine.Core/ - - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID - + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID --commitMessage "$TRAVIS_COMMIT_MESSAGE" From 68b54082ee8f7efd2a99d1ef07afa91bcfdb58e9 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 09:56:14 +0200 Subject: [PATCH 18/29] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1faf7a5..155aff2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ script: - cd tests/TuringMachine.Core.Tests - dotnet restore - find * -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild - - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../src/TuringMachine.Core/coverage.xml' + - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../src/TuringMachine.Core/coverage.xml' /p:Exclude=\"[coverlet.*]*,[*]Coverlet.Core*\" after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - #bash <(curl -s https://codecov.io/bash) From dcdf54d3146ab13e8e145b87bed8474f5566b14f Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 10:04:47 +0200 Subject: [PATCH 19/29] Update .travis.yml --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 155aff2..423ed56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,17 +30,17 @@ script: - cd tests/TuringMachine.Core.Tests - dotnet restore - find * -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild - - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../src/TuringMachine.Core/coverage.xml' /p:Exclude=\"[coverlet.*]*,[*]Coverlet.Core*\" + - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../src/coverage.xml' /p:Exclude=\"[coverlet.*]*,[*]Coverlet.Core*\" after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - #bash <(curl -s https://codecov.io/bash) - - #REPO_COMMIT_AUTHOR=$(git show -s --pretty=format:"%cn") - - #REPO_COMMIT_AUTHOR_EMAIL=$(git show -s --pretty=format:"%ce") - - #echo $REPO_COMMIT_AUTHOR - - #echo $REPO_COMMIT_AUTHOR_EMAIL + - REPO_COMMIT_AUTHOR=$(git show -s --pretty=format:"%cn") + - REPO_COMMIT_AUTHOR_EMAIL=$(git show -s --pretty=format:"%ce") + - echo $REPO_COMMIT_AUTHOR + - echo $REPO_COMMIT_AUTHOR_EMAIL - echo $TRAVIS_COMMIT_MESSAGE - echo $TRAVIS_COMMIT - echo $TRAVIS_BRANCH - echo $TRAVIS_JOB_ID - - cd ../../src/TuringMachine.Core/ + - cd ../../src/ - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID --commitMessage "$TRAVIS_COMMIT_MESSAGE" From 71103b5961460e984f6ba4927eebb7561893f6ff Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 10:17:15 +0200 Subject: [PATCH 20/29] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 423ed56..53a4cb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ script: - cd tests/TuringMachine.Core.Tests - dotnet restore - find * -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild - - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../src/coverage.xml' /p:Exclude=\"[coverlet.*]*,[*]Coverlet.Core*\" + - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../coverage.xml' /p:Exclude=\"[coverlet.*]*,[*]Coverlet.Core*\" after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - #bash <(curl -s https://codecov.io/bash) @@ -42,5 +42,5 @@ after_success: - echo $TRAVIS_COMMIT - echo $TRAVIS_BRANCH - echo $TRAVIS_JOB_ID - - cd ../../src/ + - cd ../../ - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID --commitMessage "$TRAVIS_COMMIT_MESSAGE" From d0339de4b404ec0e41782aa153b0793dd4ac9d7c Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 10:37:04 +0200 Subject: [PATCH 21/29] Update .travis.yml --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 53a4cb1..77310c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,14 +33,10 @@ script: - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../coverage.xml' /p:Exclude=\"[coverlet.*]*,[*]Coverlet.Core*\" after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - - #bash <(curl -s https://codecov.io/bash) +# - bash <(curl -s https://codecov.io/bash) - REPO_COMMIT_AUTHOR=$(git show -s --pretty=format:"%cn") - REPO_COMMIT_AUTHOR_EMAIL=$(git show -s --pretty=format:"%ce") - echo $REPO_COMMIT_AUTHOR - echo $REPO_COMMIT_AUTHOR_EMAIL - - echo $TRAVIS_COMMIT_MESSAGE - - echo $TRAVIS_COMMIT - - echo $TRAVIS_BRANCH - - echo $TRAVIS_JOB_ID - cd ../../ - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID --commitMessage "$TRAVIS_COMMIT_MESSAGE" From 4b0a3c6a969e141e55324ac52dfc576d73b90886 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 10:43:59 +0200 Subject: [PATCH 22/29] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 77310c1..9317364 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,9 +34,9 @@ script: after_success: - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" # - bash <(curl -s https://codecov.io/bash) + - cd ../../ - REPO_COMMIT_AUTHOR=$(git show -s --pretty=format:"%cn") - REPO_COMMIT_AUTHOR_EMAIL=$(git show -s --pretty=format:"%ce") - echo $REPO_COMMIT_AUTHOR - echo $REPO_COMMIT_AUTHOR_EMAIL - - cd ../../ - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID --commitMessage "$TRAVIS_COMMIT_MESSAGE" From 50ccfcfde911d7f223ab9fccefb58ab726eff1e7 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 17:02:14 +0200 Subject: [PATCH 23/29] Remove echo --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9317364..8002621 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,4 @@ after_success: - cd ../../ - REPO_COMMIT_AUTHOR=$(git show -s --pretty=format:"%cn") - REPO_COMMIT_AUTHOR_EMAIL=$(git show -s --pretty=format:"%ce") - - echo $REPO_COMMIT_AUTHOR - - echo $REPO_COMMIT_AUTHOR_EMAIL - - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID --commitMessage "$TRAVIS_COMMIT_MESSAGE" + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID --commitMessage "$TRAVIS_COMMIT_MESSAGE" --commitAuthor "$REPO_COMMIT_AUTHOR" --commitEmail "$REPO_COMMIT_AUTHOR_EMAIL" From da83c21a310c57698781f05a6200652dba1066aa Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 17:05:24 +0200 Subject: [PATCH 24/29] Author --- .travis.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8002621..2332200 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,10 @@ install: - dotnet-format --version - csmacnz.Coveralls --version before_script: - - echo "Checking format ..." + - echo "Extracting author information ..." + - export COMMITTER_EMAIL="$(git log -1 $TRAVIS_COMMIT --pretty="%cE")" + - export AUTHOR_NAME="$(git log -1 $TRAVIS_COMMIT --pretty="%aN")" + - echo "Checking format ..." - dotnet format --check --dry-run -w src/TuringMachine -v diagnostic - dotnet format --check --dry-run -w src/TuringMachine.Core -v diagnostic - dotnet format --check --dry-run -w tests/TuringMachine.Core.Tests -v diagnostic @@ -32,9 +35,7 @@ script: - find * -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../coverage.xml' /p:Exclude=\"[coverlet.*]*,[*]Coverlet.Core*\" after_success: - - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" + - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG) Author($AUTHOR_NAME) CommitterEmail($COMMITTER_EMAIL)" # - bash <(curl -s https://codecov.io/bash) - cd ../../ - - REPO_COMMIT_AUTHOR=$(git show -s --pretty=format:"%cn") - - REPO_COMMIT_AUTHOR_EMAIL=$(git show -s --pretty=format:"%ce") - - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID --commitMessage "$TRAVIS_COMMIT_MESSAGE" --commitAuthor "$REPO_COMMIT_AUTHOR" --commitEmail "$REPO_COMMIT_AUTHOR_EMAIL" + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID --commitMessage "$TRAVIS_COMMIT_MESSAGE" --commitAuthor "$AUTHOR_NAME" --commitEmail "$COMMITTER_EMAIL" From dd81e69f0c157a93e38a061f094c12dc090a9966 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 17:07:37 +0200 Subject: [PATCH 25/29] Readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ae54880..be00700 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Current TravisCI build status. - - Current Coverage Status. + + Coverage Status License. From bad0f35a3334b2f57add5fc9368fbced0172f72c Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 17:22:35 +0200 Subject: [PATCH 26/29] Fix some issues --- .../Fuzzers/Mutational/MutationalTest.cs | 7 +++-- .../FuzzingStreamTest.cs | 26 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/TuringMachine.Core.Tests/Fuzzers/Mutational/MutationalTest.cs b/tests/TuringMachine.Core.Tests/Fuzzers/Mutational/MutationalTest.cs index 0a7297a..059da7e 100644 --- a/tests/TuringMachine.Core.Tests/Fuzzers/Mutational/MutationalTest.cs +++ b/tests/TuringMachine.Core.Tests/Fuzzers/Mutational/MutationalTest.cs @@ -340,6 +340,7 @@ public void MutationalEntryPeerByteTest() entry.Changes.Add(new MutationalChange() { Weight = 5, + Description = "Add A", Append = new MutationalFromTo((byte)'A'), RemoveLength = new FromToValue(1), AppendIterations = new FromToValue(1) @@ -348,6 +349,7 @@ public void MutationalEntryPeerByteTest() { // Remmove Weight = 1, + Description = "Remove", RemoveLength = new FromToValue(1), AppendIterations = new FromToValue(1) }); @@ -407,13 +409,14 @@ public void MutationalEntryPeerByteTest() // Max changes 2 + entry.Changes.RemoveAt(1); entry.ValidOffset = new FromToValue(0, long.MaxValue); entry.MaxChanges = new FromToValue(2); - input = new ManualFuzzingInput(new byte[100]); + using (var stream = new FuzzingStream(config, input.GetStream())) { - stream.CopyTo(new MemoryStream(), 100); + stream.CopyTo(new MemoryStream(), 16); Assert.AreEqual(2, stream.Log.Length); Assert.AreEqual(0, stream.Log[0].Offset); diff --git a/tests/TuringMachine.Core.Tests/FuzzingStreamTest.cs b/tests/TuringMachine.Core.Tests/FuzzingStreamTest.cs index 8a976a3..ab4399d 100644 --- a/tests/TuringMachine.Core.Tests/FuzzingStreamTest.cs +++ b/tests/TuringMachine.Core.Tests/FuzzingStreamTest.cs @@ -10,6 +10,32 @@ namespace TuringMachine.Core.Tests [TestFixture] public class FuzzingStreamTest { + class Disposable : IDisposable + { + public int IsDisposed = 0; + + public void Dispose() + { + IsDisposed++; + } + } + + [Test] + public void DisposeTest() + { + var original = new byte[90]; + var disposed = new Disposable(); + + using (var stream = new FuzzingStream(null, original)) + { + stream.Variables.Add(0, disposed); + + Assert.AreEqual(0, disposed.IsDisposed); + } + + Assert.AreEqual(1, disposed.IsDisposed); + } + [Test] public void CleanTest() { From e69b20f7f258448c57a879a58bf19a39273d63cc Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 17:38:31 +0200 Subject: [PATCH 27/29] Some UT --- .../Extensions/ObjectExtensions.cs | 7 ++- .../Fuzzers/Mutational/MutationalChunk.cs | 2 +- .../Extensions/ObjectExtensionsTest.cs | 51 +++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 tests/TuringMachine.Core.Tests/Extensions/ObjectExtensionsTest.cs diff --git a/src/TuringMachine.Core/Extensions/ObjectExtensions.cs b/src/TuringMachine.Core/Extensions/ObjectExtensions.cs index 95bb63e..8096632 100644 --- a/src/TuringMachine.Core/Extensions/ObjectExtensions.cs +++ b/src/TuringMachine.Core/Extensions/ObjectExtensions.cs @@ -35,6 +35,11 @@ public static bool EqualWithNullCheck(this IEquatable a, IEquatable b) /// True if are equals public static bool SequenceEqualWithNullCheck(this IList a, IList b) { + if (typeof(T) == typeof(byte[])) + { + return ChunkSequenceEqualWithNullCheck((IList)a, (IList)b); + } + if ((a == null) != (b == null)) { return false; @@ -50,7 +55,7 @@ public static bool SequenceEqualWithNullCheck(this IList a, IList b) /// A /// B /// True if are equals - public static bool ChunkSequenceEqualWithNullCheck(this IList chunks1, IList chunks2) + private static bool ChunkSequenceEqualWithNullCheck(this IList chunks1, IList chunks2) { if ((chunks1 == null) != (chunks2 == null)) return false; if (chunks1 == null) return true; diff --git a/src/TuringMachine.Core/Fuzzers/Mutational/MutationalChunk.cs b/src/TuringMachine.Core/Fuzzers/Mutational/MutationalChunk.cs index 81ca19d..b71a73f 100644 --- a/src/TuringMachine.Core/Fuzzers/Mutational/MutationalChunk.cs +++ b/src/TuringMachine.Core/Fuzzers/Mutational/MutationalChunk.cs @@ -94,7 +94,7 @@ public bool Equals(MutationalChunk obj) if (obj == null) return false; return obj.Type == Type - && obj.Allowed.ChunkSequenceEqualWithNullCheck(Allowed); + && obj.Allowed.SequenceEqualWithNullCheck(Allowed); } /// diff --git a/tests/TuringMachine.Core.Tests/Extensions/ObjectExtensionsTest.cs b/tests/TuringMachine.Core.Tests/Extensions/ObjectExtensionsTest.cs new file mode 100644 index 0000000..3c8a361 --- /dev/null +++ b/tests/TuringMachine.Core.Tests/Extensions/ObjectExtensionsTest.cs @@ -0,0 +1,51 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Net; +using TuringMachine.Core.Extensions; + +namespace TuringMachine.Core.Tests.Extensions +{ + [TestFixture] + public class ObjectExtensionsTest + { + [Test] + public void ClearTest() + { + // IPEndPoint + + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck(new IPEndPoint(0, 1), null)); + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck(null, new IPEndPoint(0, 1))); + Assert.IsTrue(ObjectExtensions.EqualWithNullCheck(new IPEndPoint(0, 1), new IPEndPoint(0, 1))); + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck(new IPEndPoint(0, 1), new IPEndPoint(0, 2))); + + // Byte[] + + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new byte[] { 0x00, 0x01 }, null)); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(null, new byte[] { 0x00, 0x01 })); + Assert.IsTrue(ObjectExtensions.SequenceEqualWithNullCheck(new byte[] { 0x00, 0x01 }, new byte[] { 0x00, 0x01 })); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new byte[] { 0x00, 0x01 }, new byte[] { 0x00, 0x02 })); + + // IList + + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[] { 0x00, 0x01 }), null)); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(null, new List(new byte[] { 0x00, 0x01 }))); + Assert.IsTrue(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[] { 0x00, 0x01 }), new List(new byte[] { 0x00, 0x01 }))); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[] { 0x00, 0x01 }), new List(new byte[] { 0x00, 0x02 }))); + + // IEquatable + + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck((IEquatable)new Decimal(1), null)); + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck(null, (IEquatable)new Decimal(1))); + Assert.IsTrue(ObjectExtensions.EqualWithNullCheck((IEquatable)new Decimal(1), (IEquatable)new Decimal(1))); + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck((IEquatable)new Decimal(1), (IEquatable)new Decimal(2))); + + // IList + + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[][] { new byte[] { 0x00, 0x01 } }), null)); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(null, new List(new byte[][] { new byte[] { 0x00, 0x01 } }))); + Assert.IsTrue(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[][] { new byte[] { 0x00, 0x01 } }), new List(new byte[][] { new byte[] { 0x00, 0x01 } }))); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[][] { new byte[] { 0x00, 0x01 } }), new List(new byte[][] { new byte[] { 0x00, 0x02 } }))); + } + } +} From 115eac025d35a7e9cb2e12de446d9ebd1f74683c Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 17:40:45 +0200 Subject: [PATCH 28/29] Change to coveralls Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Update .travis.yml Remove echo Author Readme Fix some issues Some UT --- .travis.yml | 15 ++++-- README.md | 4 +- .../Extensions/ObjectExtensions.cs | 7 ++- .../Fuzzers/Mutational/MutationalChunk.cs | 2 +- .../Extensions/ObjectExtensionsTest.cs | 51 +++++++++++++++++++ .../Fuzzers/Mutational/MutationalTest.cs | 7 ++- .../FuzzingStreamTest.cs | 26 ++++++++++ 7 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 tests/TuringMachine.Core.Tests/Extensions/ObjectExtensionsTest.cs diff --git a/.travis.yml b/.travis.yml index 5a784ae..2332200 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,10 +14,15 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ulimit -n 2048; fi install: - dotnet tool install -g dotnet-format --version 4.0.40103 --add-source https://dotnet.myget.org/F/format/api/v3/index.json + - dotnet tool install -g coveralls.net --version 1.0.0 - export PATH="$PATH:$HOME/.dotnet/tools" - dotnet-format --version + - csmacnz.Coveralls --version before_script: - - echo "Checking format ..." + - echo "Extracting author information ..." + - export COMMITTER_EMAIL="$(git log -1 $TRAVIS_COMMIT --pretty="%cE")" + - export AUTHOR_NAME="$(git log -1 $TRAVIS_COMMIT --pretty="%aN")" + - echo "Checking format ..." - dotnet format --check --dry-run -w src/TuringMachine -v diagnostic - dotnet format --check --dry-run -w src/TuringMachine.Core -v diagnostic - dotnet format --check --dry-run -w tests/TuringMachine.Core.Tests -v diagnostic @@ -28,7 +33,9 @@ script: - cd tests/TuringMachine.Core.Tests - dotnet restore - find * -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild - - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + - dotnet test -v m /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput='../../coverage.xml' /p:Exclude=\"[coverlet.*]*,[*]Coverlet.Core*\" after_success: - - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - - bash <(curl -s https://codecov.io/bash) + - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG) Author($AUTHOR_NAME) CommitterEmail($COMMITTER_EMAIL)" +# - bash <(curl -s https://codecov.io/bash) + - cd ../../ + - csmacnz.Coveralls --opencover -i coverage.xml --repoTokenVariable COVERALLS_REPO_TOKEN --useRelativePaths --commitId $TRAVIS_COMMIT --commitBranch $TRAVIS_BRANCH --jobId $TRAVIS_JOB_ID --commitMessage "$TRAVIS_COMMIT_MESSAGE" --commitAuthor "$AUTHOR_NAME" --commitEmail "$COMMITTER_EMAIL" diff --git a/README.md b/README.md index ae54880..be00700 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Current TravisCI build status. - - Current Coverage Status. + + Coverage Status License. diff --git a/src/TuringMachine.Core/Extensions/ObjectExtensions.cs b/src/TuringMachine.Core/Extensions/ObjectExtensions.cs index 95bb63e..8096632 100644 --- a/src/TuringMachine.Core/Extensions/ObjectExtensions.cs +++ b/src/TuringMachine.Core/Extensions/ObjectExtensions.cs @@ -35,6 +35,11 @@ public static bool EqualWithNullCheck(this IEquatable a, IEquatable b) /// True if are equals public static bool SequenceEqualWithNullCheck(this IList a, IList b) { + if (typeof(T) == typeof(byte[])) + { + return ChunkSequenceEqualWithNullCheck((IList)a, (IList)b); + } + if ((a == null) != (b == null)) { return false; @@ -50,7 +55,7 @@ public static bool SequenceEqualWithNullCheck(this IList a, IList b) /// A /// B /// True if are equals - public static bool ChunkSequenceEqualWithNullCheck(this IList chunks1, IList chunks2) + private static bool ChunkSequenceEqualWithNullCheck(this IList chunks1, IList chunks2) { if ((chunks1 == null) != (chunks2 == null)) return false; if (chunks1 == null) return true; diff --git a/src/TuringMachine.Core/Fuzzers/Mutational/MutationalChunk.cs b/src/TuringMachine.Core/Fuzzers/Mutational/MutationalChunk.cs index 81ca19d..b71a73f 100644 --- a/src/TuringMachine.Core/Fuzzers/Mutational/MutationalChunk.cs +++ b/src/TuringMachine.Core/Fuzzers/Mutational/MutationalChunk.cs @@ -94,7 +94,7 @@ public bool Equals(MutationalChunk obj) if (obj == null) return false; return obj.Type == Type - && obj.Allowed.ChunkSequenceEqualWithNullCheck(Allowed); + && obj.Allowed.SequenceEqualWithNullCheck(Allowed); } /// diff --git a/tests/TuringMachine.Core.Tests/Extensions/ObjectExtensionsTest.cs b/tests/TuringMachine.Core.Tests/Extensions/ObjectExtensionsTest.cs new file mode 100644 index 0000000..3c8a361 --- /dev/null +++ b/tests/TuringMachine.Core.Tests/Extensions/ObjectExtensionsTest.cs @@ -0,0 +1,51 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Net; +using TuringMachine.Core.Extensions; + +namespace TuringMachine.Core.Tests.Extensions +{ + [TestFixture] + public class ObjectExtensionsTest + { + [Test] + public void ClearTest() + { + // IPEndPoint + + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck(new IPEndPoint(0, 1), null)); + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck(null, new IPEndPoint(0, 1))); + Assert.IsTrue(ObjectExtensions.EqualWithNullCheck(new IPEndPoint(0, 1), new IPEndPoint(0, 1))); + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck(new IPEndPoint(0, 1), new IPEndPoint(0, 2))); + + // Byte[] + + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new byte[] { 0x00, 0x01 }, null)); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(null, new byte[] { 0x00, 0x01 })); + Assert.IsTrue(ObjectExtensions.SequenceEqualWithNullCheck(new byte[] { 0x00, 0x01 }, new byte[] { 0x00, 0x01 })); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new byte[] { 0x00, 0x01 }, new byte[] { 0x00, 0x02 })); + + // IList + + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[] { 0x00, 0x01 }), null)); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(null, new List(new byte[] { 0x00, 0x01 }))); + Assert.IsTrue(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[] { 0x00, 0x01 }), new List(new byte[] { 0x00, 0x01 }))); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[] { 0x00, 0x01 }), new List(new byte[] { 0x00, 0x02 }))); + + // IEquatable + + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck((IEquatable)new Decimal(1), null)); + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck(null, (IEquatable)new Decimal(1))); + Assert.IsTrue(ObjectExtensions.EqualWithNullCheck((IEquatable)new Decimal(1), (IEquatable)new Decimal(1))); + Assert.IsFalse(ObjectExtensions.EqualWithNullCheck((IEquatable)new Decimal(1), (IEquatable)new Decimal(2))); + + // IList + + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[][] { new byte[] { 0x00, 0x01 } }), null)); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(null, new List(new byte[][] { new byte[] { 0x00, 0x01 } }))); + Assert.IsTrue(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[][] { new byte[] { 0x00, 0x01 } }), new List(new byte[][] { new byte[] { 0x00, 0x01 } }))); + Assert.IsFalse(ObjectExtensions.SequenceEqualWithNullCheck(new List(new byte[][] { new byte[] { 0x00, 0x01 } }), new List(new byte[][] { new byte[] { 0x00, 0x02 } }))); + } + } +} diff --git a/tests/TuringMachine.Core.Tests/Fuzzers/Mutational/MutationalTest.cs b/tests/TuringMachine.Core.Tests/Fuzzers/Mutational/MutationalTest.cs index 0a7297a..059da7e 100644 --- a/tests/TuringMachine.Core.Tests/Fuzzers/Mutational/MutationalTest.cs +++ b/tests/TuringMachine.Core.Tests/Fuzzers/Mutational/MutationalTest.cs @@ -340,6 +340,7 @@ public void MutationalEntryPeerByteTest() entry.Changes.Add(new MutationalChange() { Weight = 5, + Description = "Add A", Append = new MutationalFromTo((byte)'A'), RemoveLength = new FromToValue(1), AppendIterations = new FromToValue(1) @@ -348,6 +349,7 @@ public void MutationalEntryPeerByteTest() { // Remmove Weight = 1, + Description = "Remove", RemoveLength = new FromToValue(1), AppendIterations = new FromToValue(1) }); @@ -407,13 +409,14 @@ public void MutationalEntryPeerByteTest() // Max changes 2 + entry.Changes.RemoveAt(1); entry.ValidOffset = new FromToValue(0, long.MaxValue); entry.MaxChanges = new FromToValue(2); - input = new ManualFuzzingInput(new byte[100]); + using (var stream = new FuzzingStream(config, input.GetStream())) { - stream.CopyTo(new MemoryStream(), 100); + stream.CopyTo(new MemoryStream(), 16); Assert.AreEqual(2, stream.Log.Length); Assert.AreEqual(0, stream.Log[0].Offset); diff --git a/tests/TuringMachine.Core.Tests/FuzzingStreamTest.cs b/tests/TuringMachine.Core.Tests/FuzzingStreamTest.cs index 8a976a3..ab4399d 100644 --- a/tests/TuringMachine.Core.Tests/FuzzingStreamTest.cs +++ b/tests/TuringMachine.Core.Tests/FuzzingStreamTest.cs @@ -10,6 +10,32 @@ namespace TuringMachine.Core.Tests [TestFixture] public class FuzzingStreamTest { + class Disposable : IDisposable + { + public int IsDisposed = 0; + + public void Dispose() + { + IsDisposed++; + } + } + + [Test] + public void DisposeTest() + { + var original = new byte[90]; + var disposed = new Disposable(); + + using (var stream = new FuzzingStream(null, original)) + { + stream.Variables.Add(0, disposed); + + Assert.AreEqual(0, disposed.IsDisposed); + } + + Assert.AreEqual(1, disposed.IsDisposed); + } + [Test] public void CleanTest() { From 8a672ace9169ed2ab9082f847a175ee14a44473b Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 17 Oct 2019 17:49:36 +0200 Subject: [PATCH 29/29] ClientName --- tests/TuringMachine.Core.Tests/FuzzerTest.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/TuringMachine.Core.Tests/FuzzerTest.cs b/tests/TuringMachine.Core.Tests/FuzzerTest.cs index d8fc8c4..b8da7d4 100644 --- a/tests/TuringMachine.Core.Tests/FuzzerTest.cs +++ b/tests/TuringMachine.Core.Tests/FuzzerTest.cs @@ -67,6 +67,10 @@ private void Test(FuzzerConnectionBase serverConnection, FuzzerConnectionBase cl using (var server = new FuzzerServer()) using (var client = new FuzzerClient()) { + // Change name + + client.PublicName = "TestClient_" + Guid.NewGuid().ToString(); + // Ensure no error client.SendLog(null); @@ -143,7 +147,7 @@ private void Test(FuzzerConnectionBase serverConnection, FuzzerConnectionBase cl Assert.IsTrue(waitInput.WaitOne(TimeSpan.FromSeconds(10)), "Waiting for inputs"); Assert.AreEqual(1, server.Connections.Count); - Assert.IsTrue(!string.IsNullOrEmpty(server.Connections.Values.FirstOrDefault()?.Source.Description)); + Assert.IsTrue(server.Connections.Values.FirstOrDefault()?.Source.Description.Contains(client.PublicName)); Assert.AreNotEqual(Guid.Empty, server.Connections.Values.FirstOrDefault()?.Source.Id); Assert.AreNotEqual(Guid.Empty, server.Connections.Values.FirstOrDefault()?.Id);