From efde4b793043dcc1b2463a086b52186aebb278b0 Mon Sep 17 00:00:00 2001 From: James Foster Date: Sat, 9 Oct 2021 22:32:33 -0700 Subject: [PATCH 1/6] Switch Windows tests back to Windows. --- .github/workflows/windows.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 6a4afa72..e2333d7a 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -5,7 +5,7 @@ on: [push, pull_request] jobs: "unittest_lint_sampleproject": - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 @@ -23,7 +23,7 @@ jobs: bundle exec arduino_ci.rb NetworkLib: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 From 567ada3cc47b409a314f1157b7a41067140d4bdc Mon Sep 17 00:00:00 2001 From: James Foster Date: Tue, 12 Oct 2021 21:57:40 -0700 Subject: [PATCH 2/6] Try tests with `text=LF` to satisfy linter that doesn't want any CR line endings. --- .gitattributes | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitattributes b/.gitattributes index 640e8d08..dfc48c6e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,19 +1,21 @@ # https://docs.github.com/en/github/using-git/configuring-git-to-handle-line-endings # https://git-scm.com/docs/gitattributes -# https://git-scm.com/docs/git-config -# https://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/ +# https://git-scm.com/docs/git-config +# https://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/ -# Configure this repository to use Git's type detection algorithm to guess -# whether a file is text or binary. Text files will have line endings converted -# as if you had set +# Configure this repository to use Git's type detection algorithm to guess +# whether a file is text or binary. Text files will have line endings converted +# as if you had set # eol=native # That is, on Windows text files will have CRLF line endings in your working # directory while on Linux and macOS your text files will have LF line endings # in your working directory. In either case, they will have LF line endings in # the Git repository itself. -# Set the default behavior, in case people don't have core.autocrlf set. -* text=auto +# We would pick auto (so Windows users have CRLF to satisfy dumb editors), +# but the automated tests include some sort of linting that complains when +# a CR is detected. So, we use LF to force it to LF on all platforms! +* text=LF # Explicitly declare text files you want to always be normalized and converted # to native line endings on checkout. Git would likely get these right, but From 66fc3bef5f1a30b4d7e0cd6601eb93d37519b8d8 Mon Sep 17 00:00:00 2001 From: James Foster Date: Tue, 12 Oct 2021 22:15:12 -0700 Subject: [PATCH 3/6] Change `uint` to `uint16_t` to be more explicit and (we hope) satisfy the compiler that doesn't recognize `uint`! --- SampleProjects/TestSomething/test/godmode.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SampleProjects/TestSomething/test/godmode.cpp b/SampleProjects/TestSomething/test/godmode.cpp index 024b9915..24f60e1d 100644 --- a/SampleProjects/TestSomething/test/godmode.cpp +++ b/SampleProjects/TestSomething/test/godmode.cpp @@ -236,9 +236,9 @@ unittest(shift_in) { originalSize = state->digitalPin[clockPin].historySize(); input = shiftIn(dataPin, clockPin, MSBFIRST); - assertEqual(0x7C, (uint)input); // 0111 1100 + assertEqual(0x7C, (uint16_t)input); // 0111 1100 assertEqual('|', input); // 0111 1100 - assertEqual((uint)'|', (uint)input); // 0111 1100 + assertEqual((uint16_t)'|', (uint16_t)input); // 0111 1100 // now verify clock assertEqual(16, state->digitalPin[clockPin].historySize() - originalSize); @@ -249,15 +249,15 @@ unittest(shift_in) { state->reset(); state->digitalPin[dataPin].fromAscii("|", true); // 0111 1100 input = shiftIn(dataPin, clockPin, LSBFIRST); // <- note the LSB/MSB flip - assertEqual(0x3E, (uint)input); // 0011 1110 + assertEqual(0x3E, (uint16_t)input); // 0011 1110 assertEqual('>', input); // 0011 1110 - assertEqual((uint)'>', (uint)input); // 0011 1110 + assertEqual((uint16_t)'>', (uint16_t)input); // 0011 1110 // test setting MSB state->reset(); state->digitalPin[dataPin].fromAscii("U", true); // 0101 0101 input = shiftIn(dataPin, clockPin, LSBFIRST); // <- note the LSB/MSB flip - assertEqual(0xAA, (uint)input); // 1010 1010 + assertEqual(0xAA, (uint16_t)input); // 1010 1010 } unittest(shift_out) { From 88db5030686eb4e699fb14ec1b20bc4d4e0d9d7d Mon Sep 17 00:00:00 2001 From: James Foster Date: Tue, 12 Oct 2021 23:39:00 -0700 Subject: [PATCH 4/6] Fix syntax for `text eol=lf` settings. --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index dfc48c6e..d612bab7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,7 +15,7 @@ # We would pick auto (so Windows users have CRLF to satisfy dumb editors), # but the automated tests include some sort of linting that complains when # a CR is detected. So, we use LF to force it to LF on all platforms! -* text=LF +* text eol=lf # Explicitly declare text files you want to always be normalized and converted # to native line endings on checkout. Git would likely get these right, but From 7fe8f550c62e9e8917913b7948fd76cb1bf1cb9e Mon Sep 17 00:00:00 2001 From: James Foster Date: Tue, 12 Oct 2021 23:42:12 -0700 Subject: [PATCH 5/6] Was the change really needed? It looks like rubocop is complaining about CR but the test doesn't fail!? --- .gitattributes | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitattributes b/.gitattributes index d612bab7..e05cc409 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,10 +12,8 @@ # in your working directory. In either case, they will have LF line endings in # the Git repository itself. -# We would pick auto (so Windows users have CRLF to satisfy dumb editors), -# but the automated tests include some sort of linting that complains when -# a CR is detected. So, we use LF to force it to LF on all platforms! -* text eol=lf +# Set the default behavior, in case people don't have core.autocrlf set. +* text eol=auto # Explicitly declare text files you want to always be normalized and converted # to native line endings on checkout. Git would likely get these right, but From 7dc30a287b7a490e53228716c34d1a85debd62dd Mon Sep 17 00:00:00 2001 From: James Foster Date: Tue, 12 Oct 2021 23:43:18 -0700 Subject: [PATCH 6/6] Change the specific configuration again to revert to original. --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index e05cc409..6ada3e30 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,7 +13,7 @@ # the Git repository itself. # Set the default behavior, in case people don't have core.autocrlf set. -* text eol=auto +* text=auto # Explicitly declare text files you want to always be normalized and converted # to native line endings on checkout. Git would likely get these right, but