From e09a4d2f310ea4447c37eabf48db2eac0b2940d5 Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 17:29:37 -0700 Subject: [PATCH 01/14] Run "TestSomething" on Windows as well as Ubuntu. --- .github/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 8ff04914..3a40eed3 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -21,7 +21,7 @@ jobs: bundle exec rspec --backtrace "TestSomething": - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 From f50b07bc7ce739662145fc3efff53406ec456445 Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 17:50:16 -0700 Subject: [PATCH 02/14] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fdbffad..51216f91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Properly report compile errors in GitHub Actions. - Fix copy/paste error to allow additional warnings for a platform - Apply "rule of three" to Client copy constructor and copy assignment operator +- Run Windows tests on Windows not Ubuntu ### Security From ad34cba4355d160a773653126db77c0a44c7e9af Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 17:54:08 -0700 Subject: [PATCH 03/14] Properly report compile error in shared library. --- .github/workflows/linux.yaml | 18 ++++++ .github/workflows/macos.yaml | 18 ++++++ .github/workflows/windows.yaml | 18 ++++++ CHANGELOG.md | 1 + SampleProjects/SharedLibrary/.arduino-ci.yml | 7 +++ SampleProjects/SharedLibrary/.gitignore | 1 + SampleProjects/SharedLibrary/Gemfile | 2 + SampleProjects/SharedLibrary/README.md | 3 + .../SharedLibrary/library.properties | 10 +++ .../SharedLibrary/src/SharedLibrary.cpp | 5 ++ .../SharedLibrary/src/SharedLibrary.h | 3 + SampleProjects/SharedLibrary/test/test.cpp | 13 ++++ exe/arduino_ci.rb | 63 +++++++++---------- 13 files changed, 129 insertions(+), 33 deletions(-) create mode 100644 SampleProjects/SharedLibrary/.arduino-ci.yml create mode 100644 SampleProjects/SharedLibrary/.gitignore create mode 100644 SampleProjects/SharedLibrary/Gemfile create mode 100644 SampleProjects/SharedLibrary/README.md create mode 100644 SampleProjects/SharedLibrary/library.properties create mode 100644 SampleProjects/SharedLibrary/src/SharedLibrary.cpp create mode 100644 SampleProjects/SharedLibrary/src/SharedLibrary.h create mode 100644 SampleProjects/SharedLibrary/test/test.cpp diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index ea424ebe..50a90015 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -61,3 +61,21 @@ jobs: bundle exec ensure_arduino_installation.rb sh ./scripts/install.sh bundle exec arduino_ci.rb + + SharedLibrary: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + - name: Test SharedLibrary should fail + run: | + g++ -v + cd SampleProjects/SharedLibrary + bundle install + bundle exec ensure_arduino_installation.rb + bundle exec arduino_ci.rb --skip-examples-compilation + if [ $? -ne 1 ]; then + exit 1 + fi diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 8b51fd60..0265f160 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -61,3 +61,21 @@ jobs: bundle exec ensure_arduino_installation.rb sh ./scripts/install.sh bundle exec arduino_ci.rb + + SharedLibrary: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + - name: Test SharedLibrary should fail + run: | + g++ -v + cd SampleProjects/SharedLibrary + bundle install + bundle exec ensure_arduino_installation.rb + bundle exec arduino_ci.rb --skip-examples-compilation + if [ $? -ne 1 ]; then + exit 1 + fi diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 3a40eed3..d6a4b938 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -50,3 +50,21 @@ jobs: bundle exec ensure_arduino_installation.rb bash -x ./scripts/install.sh bundle exec arduino_ci.rb + + SharedLibrary: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + - name: Test SharedLibrary should fail + run: | + g++ -v + cd SampleProjects/SharedLibrary + bundle install + bundle exec ensure_arduino_installation.rb + bundle exec arduino_ci.rb --skip-examples-compilation + if [ $? -ne 1 ]; then + exit 1 + fi diff --git a/CHANGELOG.md b/CHANGELOG.md index 51216f91..16ee831b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix copy/paste error to allow additional warnings for a platform - Apply "rule of three" to Client copy constructor and copy assignment operator - Run Windows tests on Windows not Ubuntu +- Properly report error in building shared library ### Security diff --git a/SampleProjects/SharedLibrary/.arduino-ci.yml b/SampleProjects/SharedLibrary/.arduino-ci.yml new file mode 100644 index 00000000..f63d2413 --- /dev/null +++ b/SampleProjects/SharedLibrary/.arduino-ci.yml @@ -0,0 +1,7 @@ +unittest: + platforms: + - mega2560 + +compile: + platforms: + - mega2560 diff --git a/SampleProjects/SharedLibrary/.gitignore b/SampleProjects/SharedLibrary/.gitignore new file mode 100644 index 00000000..06de90aa --- /dev/null +++ b/SampleProjects/SharedLibrary/.gitignore @@ -0,0 +1 @@ +.bundle \ No newline at end of file diff --git a/SampleProjects/SharedLibrary/Gemfile b/SampleProjects/SharedLibrary/Gemfile new file mode 100644 index 00000000..b2b3b1fd --- /dev/null +++ b/SampleProjects/SharedLibrary/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'arduino_ci', path: '../../' diff --git a/SampleProjects/SharedLibrary/README.md b/SampleProjects/SharedLibrary/README.md new file mode 100644 index 00000000..40e8645c --- /dev/null +++ b/SampleProjects/SharedLibrary/README.md @@ -0,0 +1,3 @@ +# SharedLibrary + +This is an example of a shared library with a compile error (see https://github.com/Arduino-CI/arduino_ci/issues/325). diff --git a/SampleProjects/SharedLibrary/library.properties b/SampleProjects/SharedLibrary/library.properties new file mode 100644 index 00000000..5f9d3662 --- /dev/null +++ b/SampleProjects/SharedLibrary/library.properties @@ -0,0 +1,10 @@ +name=SharedLibrary +version=0.1.0 +author=James Foster +maintainer=James Foster +sentence=Sample shared library to validate that we catch compile errors +paragraph=Sample shared library to validate that we catch compile errors +category=Other +url=https://github.com/Arduino-CI/arduino_ci/SampleProjects/SharedLibrary +architectures=avr,esp8266 +includes=SharedLibrary.h diff --git a/SampleProjects/SharedLibrary/src/SharedLibrary.cpp b/SampleProjects/SharedLibrary/src/SharedLibrary.cpp new file mode 100644 index 00000000..173ea68a --- /dev/null +++ b/SampleProjects/SharedLibrary/src/SharedLibrary.cpp @@ -0,0 +1,5 @@ +#include "SharedLibrary.h" + +void main() { + return foo; // unrecognized variable +} diff --git a/SampleProjects/SharedLibrary/src/SharedLibrary.h b/SampleProjects/SharedLibrary/src/SharedLibrary.h new file mode 100644 index 00000000..9ee81b24 --- /dev/null +++ b/SampleProjects/SharedLibrary/src/SharedLibrary.h @@ -0,0 +1,3 @@ +#pragma once + +#include diff --git a/SampleProjects/SharedLibrary/test/test.cpp b/SampleProjects/SharedLibrary/test/test.cpp new file mode 100644 index 00000000..b834b9dd --- /dev/null +++ b/SampleProjects/SharedLibrary/test/test.cpp @@ -0,0 +1,13 @@ +/* +cd SampleProjects/SharedLibrary +bundle config --local path vendor/bundle +bundle install +bundle exec arduino_ci.rb --skip-examples-compilation +*/ + +#include +#include + +unittest(test) { assertEqual(true, false); } + +unittest_main() diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index ebaa1452..1b2522b3 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -423,46 +423,43 @@ def perform_unit_tests(cpp_library, file_config) puts compilers.each do |gcc_binary| # before compiling the tests, build a shared library of everything except the test code - next unless build_shared_library(gcc_binary, p, config, cpp_library) - - # now build and run each test using the shared library build above - config.allowable_unittest_files(cpp_library.test_files).each do |unittest_path| - unittest_name = unittest_path.basename.to_s - puts "--------------------------------------------------------------------------------" - attempt_multiline("Unit testing #{unittest_name} with #{gcc_binary} for #{p}") do - exe = cpp_library.build_for_test(unittest_path, gcc_binary) - puts - unless exe - puts "Last command: #{cpp_library.last_cmd}" - puts cpp_library.last_out - puts cpp_library.last_err - next false + got_shared_library = true + attempt_multiline("Build shared library with #{gcc_binary} for #{p}") do + exe = cpp_library.build_shared_library( + config.aux_libraries_for_unittest, + gcc_binary, + config.gcc_config(p) + ) + unless exe + puts "Last command: #{cpp_library.last_cmd}" + puts cpp_library.last_out + puts cpp_library.last_err + got_shared_library = false + end + next true # got_shared_library + end + if got_shared_library + # now build and run each test using the shared library build above + config.allowable_unittest_files(cpp_library.test_files).each do |unittest_path| + unittest_name = unittest_path.basename.to_s + puts "--------------------------------------------------------------------------------" + attempt_multiline("Unit testing #{unittest_name} with #{gcc_binary} for #{p}") do + exe = cpp_library.build_for_test(unittest_path, gcc_binary) + puts + unless exe + puts "Last command: #{cpp_library.last_cmd}" + puts cpp_library.last_out + puts cpp_library.last_err + next false + end + cpp_library.run_test_file(exe) end - cpp_library.run_test_file(exe) end end end end end -def build_shared_library(gcc_binary, platform, config, cpp_library) - attempt_multiline("Build shared library with #{gcc_binary} for #{platform}") do - exe = cpp_library.build_shared_library( - config.aux_libraries_for_unittest, - gcc_binary, - config.gcc_config(platform) - ) - puts - unless exe - puts "Last command: #{cpp_library.last_cmd}" - puts cpp_library.last_out - puts cpp_library.last_err - return false - end - return true - end -end - def perform_example_compilation_tests(cpp_library, config) phase("Compilation of example sketches") if @cli_options[:skip_compilation] From 2b012569d02f69b49615c33161d5481f3ac43c0c Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 18:07:01 -0700 Subject: [PATCH 04/14] See if fixing code causes test to pass. --- exe/arduino_ci.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index 1b2522b3..7e0423c9 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -436,7 +436,7 @@ def perform_unit_tests(cpp_library, file_config) puts cpp_library.last_err got_shared_library = false end - next true # got_shared_library + next got_shared_library end if got_shared_library # now build and run each test using the shared library build above From 7dbd96cfca5356a0c6503c0be353a8e87d14aa1f Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 19:42:57 -0700 Subject: [PATCH 05/14] Try fixes for errors --- .github/workflows/linux.yaml | 5 ++++- exe/arduino_ci.rb | 31 ++++++++++++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 50a90015..e2ac5442 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -76,6 +76,9 @@ jobs: bundle install bundle exec ensure_arduino_installation.rb bundle exec arduino_ci.rb --skip-examples-compilation - if [ $? -ne 1 ]; then + status = $? + echo "Status = $status" + if [ $status -ne 1 ]; then exit 1 fi + exit 0 diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index 7e0423c9..cd0215ac 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -438,22 +438,23 @@ def perform_unit_tests(cpp_library, file_config) end next got_shared_library end - if got_shared_library - # now build and run each test using the shared library build above - config.allowable_unittest_files(cpp_library.test_files).each do |unittest_path| - unittest_name = unittest_path.basename.to_s - puts "--------------------------------------------------------------------------------" - attempt_multiline("Unit testing #{unittest_name} with #{gcc_binary} for #{p}") do - exe = cpp_library.build_for_test(unittest_path, gcc_binary) - puts - unless exe - puts "Last command: #{cpp_library.last_cmd}" - puts cpp_library.last_out - puts cpp_library.last_err - next false - end - cpp_library.run_test_file(exe) + if !got_shared_library + next + end + # now build and run each test using the shared library build above + config.allowable_unittest_files(cpp_library.test_files).each do |unittest_path| + unittest_name = unittest_path.basename.to_s + puts "--------------------------------------------------------------------------------" + attempt_multiline("Unit testing #{unittest_name} with #{gcc_binary} for #{p}") do + exe = cpp_library.build_for_test(unittest_path, gcc_binary) + puts + unless exe + puts "Last command: #{cpp_library.last_cmd}" + puts cpp_library.last_out + puts cpp_library.last_err + next false end + cpp_library.run_test_file(exe) end end end From 012f5bb99a1a37d7ed067f5656e2ca312fb20ab6 Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 20:09:19 -0700 Subject: [PATCH 06/14] WIP: use `eval` and `next unless` --- .github/workflows/linux.yaml | 3 +-- SampleProjects/SharedLibrary/src/SharedLibrary.cpp | 4 ++-- exe/arduino_ci.rb | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index e2ac5442..bf2cd096 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -75,8 +75,7 @@ jobs: cd SampleProjects/SharedLibrary bundle install bundle exec ensure_arduino_installation.rb - bundle exec arduino_ci.rb --skip-examples-compilation - status = $? + status = eval "bundle exec arduino_ci.rb --skip-examples-compilation" echo "Status = $status" if [ $status -ne 1 ]; then exit 1 diff --git a/SampleProjects/SharedLibrary/src/SharedLibrary.cpp b/SampleProjects/SharedLibrary/src/SharedLibrary.cpp index 173ea68a..347aaf17 100644 --- a/SampleProjects/SharedLibrary/src/SharedLibrary.cpp +++ b/SampleProjects/SharedLibrary/src/SharedLibrary.cpp @@ -1,5 +1,5 @@ #include "SharedLibrary.h" -void main() { - return foo; // unrecognized variable +int main() { + return foo; // 'foo' was not declared in this scope } diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index cd0215ac..be0e09d9 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -438,9 +438,7 @@ def perform_unit_tests(cpp_library, file_config) end next got_shared_library end - if !got_shared_library - next - end + next unless got_shared_library # now build and run each test using the shared library build above config.allowable_unittest_files(cpp_library.test_files).each do |unittest_path| unittest_name = unittest_path.basename.to_s From 71a18b3ed1c24f5a922faf95f77b0df5caca89dc Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 20:11:31 -0700 Subject: [PATCH 07/14] WIP: blank line; another attempt to capture status --- .github/workflows/linux.yaml | 3 ++- exe/arduino_ci.rb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index bf2cd096..52f47983 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -75,7 +75,8 @@ jobs: cd SampleProjects/SharedLibrary bundle install bundle exec ensure_arduino_installation.rb - status = eval "bundle exec arduino_ci.rb --skip-examples-compilation" + eval "bundle exec arduino_ci.rb --skip-examples-compilation" + status = $? echo "Status = $status" if [ $status -ne 1 ]; then exit 1 diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index be0e09d9..175cdb2c 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -439,6 +439,7 @@ def perform_unit_tests(cpp_library, file_config) next got_shared_library end next unless got_shared_library + # now build and run each test using the shared library build above config.allowable_unittest_files(cpp_library.test_files).each do |unittest_path| unittest_name = unittest_path.basename.to_s From 18c43a52d7ade800c94ed3929d131c3aa21f275d Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 20:16:12 -0700 Subject: [PATCH 08/14] WIP: another attempt at a status code --- .github/workflows/linux.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 52f47983..8354cc9e 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -75,10 +75,10 @@ jobs: cd SampleProjects/SharedLibrary bundle install bundle exec ensure_arduino_installation.rb - eval "bundle exec arduino_ci.rb --skip-examples-compilation" - status = $? - echo "Status = $status" - if [ $status -ne 1 ]; then - exit 1 - fi - exit 0 + eval "bundle exec arduino_ci.rb --skip-examples-compilation; echo status = $?" + # status = $? + # echo "Status = $status" + # if [ $status -ne 1 ]; then + # exit 1 + # fi + # exit 0 From d7b76a871b4665cde3dc6bfe2456a6e28777f4b1 Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 20:21:17 -0700 Subject: [PATCH 09/14] Move test script into separate file. --- .github/workflows/linux.yaml | 13 +------------ SampleProjects/SharedLibrary/test.sh | 11 +++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 SampleProjects/SharedLibrary/test.sh diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 8354cc9e..c16122f2 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -70,15 +70,4 @@ jobs: with: ruby-version: 2.6 - name: Test SharedLibrary should fail - run: | - g++ -v - cd SampleProjects/SharedLibrary - bundle install - bundle exec ensure_arduino_installation.rb - eval "bundle exec arduino_ci.rb --skip-examples-compilation; echo status = $?" - # status = $? - # echo "Status = $status" - # if [ $status -ne 1 ]; then - # exit 1 - # fi - # exit 0 + run: test.sh diff --git a/SampleProjects/SharedLibrary/test.sh b/SampleProjects/SharedLibrary/test.sh new file mode 100644 index 00000000..48d615f3 --- /dev/null +++ b/SampleProjects/SharedLibrary/test.sh @@ -0,0 +1,11 @@ +g++ -v +cd SampleProjects/SharedLibrary +bundle install +bundle exec ensure_arduino_installation.rb +bundle exec arduino_ci.rb --skip-examples-compilation +echo status=$? +echo "Status = $status" +if [ $status -ne 1 ]; then + exit 1 +fi +exit 0 From da3be8f6e177b7392e7dd12ed0b5a25f1e94ff89 Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 20:22:49 -0700 Subject: [PATCH 10/14] path to test script --- .github/workflows/linux.yaml | 2 +- SampleProjects/SharedLibrary/test.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 SampleProjects/SharedLibrary/test.sh diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index c16122f2..a095c5b2 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -70,4 +70,4 @@ jobs: with: ruby-version: 2.6 - name: Test SharedLibrary should fail - run: test.sh + run: ./SampleProjects/SharedLibrary/test.sh diff --git a/SampleProjects/SharedLibrary/test.sh b/SampleProjects/SharedLibrary/test.sh old mode 100644 new mode 100755 From 07a9d1dcd54ca48d4416505570acb0126aea7cb8 Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 20:24:35 -0700 Subject: [PATCH 11/14] See if we can force failure. --- .github/workflows/macos.yaml | 10 +--------- .github/workflows/windows.yaml | 10 +--------- exe/arduino_ci.rb | 2 +- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 0265f160..5019f96f 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -70,12 +70,4 @@ jobs: with: ruby-version: 2.6 - name: Test SharedLibrary should fail - run: | - g++ -v - cd SampleProjects/SharedLibrary - bundle install - bundle exec ensure_arduino_installation.rb - bundle exec arduino_ci.rb --skip-examples-compilation - if [ $? -ne 1 ]; then - exit 1 - fi + run: ./SampleProjects/SharedLibrary/test.sh diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index d6a4b938..3169ea44 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -59,12 +59,4 @@ jobs: with: ruby-version: 2.6 - name: Test SharedLibrary should fail - run: | - g++ -v - cd SampleProjects/SharedLibrary - bundle install - bundle exec ensure_arduino_installation.rb - bundle exec arduino_ci.rb --skip-examples-compilation - if [ $? -ne 1 ]; then - exit 1 - fi + run: ./SampleProjects/SharedLibrary/test.sh diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index 175cdb2c..192b067a 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -436,7 +436,7 @@ def perform_unit_tests(cpp_library, file_config) puts cpp_library.last_err got_shared_library = false end - next got_shared_library + next true # got_shared_library end next unless got_shared_library From c42d2f882fdbadd26df88bb0c9287201e59a54ea Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 20:37:41 -0700 Subject: [PATCH 12/14] If there is no error reported, it should be an error! --- SampleProjects/SharedLibrary/src/SharedLibrary.cpp | 2 +- SampleProjects/SharedLibrary/test.sh | 4 ++-- exe/arduino_ci.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SampleProjects/SharedLibrary/src/SharedLibrary.cpp b/SampleProjects/SharedLibrary/src/SharedLibrary.cpp index 347aaf17..18743493 100644 --- a/SampleProjects/SharedLibrary/src/SharedLibrary.cpp +++ b/SampleProjects/SharedLibrary/src/SharedLibrary.cpp @@ -1,5 +1,5 @@ #include "SharedLibrary.h" int main() { - return foo; // 'foo' was not declared in this scope + return 0; // foo; // 'foo' was not declared in this scope } diff --git a/SampleProjects/SharedLibrary/test.sh b/SampleProjects/SharedLibrary/test.sh index 48d615f3..75b6085f 100755 --- a/SampleProjects/SharedLibrary/test.sh +++ b/SampleProjects/SharedLibrary/test.sh @@ -3,8 +3,8 @@ cd SampleProjects/SharedLibrary bundle install bundle exec ensure_arduino_installation.rb bundle exec arduino_ci.rb --skip-examples-compilation -echo status=$? -echo "Status = $status" +status=$? +echo "status=$status" if [ $status -ne 1 ]; then exit 1 fi diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index 192b067a..175cdb2c 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -436,7 +436,7 @@ def perform_unit_tests(cpp_library, file_config) puts cpp_library.last_err got_shared_library = false end - next true # got_shared_library + next got_shared_library end next unless got_shared_library From 80fda420aa18e0d24cf472f12b3c819b19dfc94d Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 20:39:36 -0700 Subject: [PATCH 13/14] Will this report a failure? --- SampleProjects/SharedLibrary/test/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SampleProjects/SharedLibrary/test/test.cpp b/SampleProjects/SharedLibrary/test/test.cpp index b834b9dd..326c978e 100644 --- a/SampleProjects/SharedLibrary/test/test.cpp +++ b/SampleProjects/SharedLibrary/test/test.cpp @@ -8,6 +8,6 @@ bundle exec arduino_ci.rb --skip-examples-compilation #include #include -unittest(test) { assertEqual(true, false); } +unittest(test) { assertEqual(true, true); } unittest_main() From 43f8d05ffd3d09bbc5643f895b713c6a4f68e4a4 Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 30 Jun 2022 20:41:37 -0700 Subject: [PATCH 14/14] This should do it! --- SampleProjects/SharedLibrary/src/SharedLibrary.cpp | 2 +- SampleProjects/SharedLibrary/test.sh | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/SampleProjects/SharedLibrary/src/SharedLibrary.cpp b/SampleProjects/SharedLibrary/src/SharedLibrary.cpp index 18743493..347aaf17 100644 --- a/SampleProjects/SharedLibrary/src/SharedLibrary.cpp +++ b/SampleProjects/SharedLibrary/src/SharedLibrary.cpp @@ -1,5 +1,5 @@ #include "SharedLibrary.h" int main() { - return 0; // foo; // 'foo' was not declared in this scope + return foo; // 'foo' was not declared in this scope } diff --git a/SampleProjects/SharedLibrary/test.sh b/SampleProjects/SharedLibrary/test.sh index 75b6085f..b5ab6e4b 100755 --- a/SampleProjects/SharedLibrary/test.sh +++ b/SampleProjects/SharedLibrary/test.sh @@ -3,9 +3,7 @@ cd SampleProjects/SharedLibrary bundle install bundle exec ensure_arduino_installation.rb bundle exec arduino_ci.rb --skip-examples-compilation -status=$? -echo "status=$status" -if [ $status -ne 1 ]; then +if [ $? -ne 1 ]; then exit 1 fi exit 0