From 7f29ee84bd3658a31190fd10de5632805c19e989 Mon Sep 17 00:00:00 2001 From: Andre Richter Date: Thu, 9 Jan 2020 22:11:56 +0100 Subject: [PATCH] Refactor utils --- .githooks/pre-commit | 17 +- .github/workflows/build_rpi3.yml | 8 +- .github/workflows/build_rpi4.yml | 8 +- .github/workflows/check_fmt_clippy.yml | 41 ----- .github/workflows/sanity.yml | 42 +++++ .github/workflows/spelling.yml | 23 --- .github/workflows/test_integration.yml | 6 +- .github/workflows/test_unit.yml | 7 +- .gitignore | 5 + .rubocop.yml | 2 +- .vscode/settings.json | 6 + Gemfile | 8 + contributor_setup.sh | 1 + utils/clean_all.rb | 25 --- utils/clippy_all.rb | 26 --- utils/devtool.rb | 215 ++++++++++++++++++++++ utils/devtool/copyright.rb | 30 +++ utils/diff_all.rb | 22 --- utils/{helpers => }/diff_tut_folders.bash | 0 utils/fmt_all.rb | 34 ---- utils/helpers/copyrighted.rb | 22 --- utils/helpers/tutorial_folders.rb | 31 ---- utils/make_all.rb | 25 --- utils/ready_for_publish.rb | 30 --- utils/sanity_checks.rb | 41 ----- utils/test_integration_all.rb | 30 --- utils/test_unit_all.rb | 23 --- 27 files changed, 341 insertions(+), 387 deletions(-) delete mode 100644 .github/workflows/check_fmt_clippy.yml create mode 100644 .github/workflows/sanity.yml delete mode 100644 .github/workflows/spelling.yml create mode 100644 .vscode/settings.json create mode 100644 Gemfile delete mode 100755 utils/clean_all.rb delete mode 100755 utils/clippy_all.rb create mode 100755 utils/devtool.rb create mode 100644 utils/devtool/copyright.rb delete mode 100755 utils/diff_all.rb rename utils/{helpers => }/diff_tut_folders.bash (100%) delete mode 100755 utils/fmt_all.rb delete mode 100644 utils/helpers/copyrighted.rb delete mode 100755 utils/helpers/tutorial_folders.rb delete mode 100755 utils/make_all.rb delete mode 100755 utils/ready_for_publish.rb delete mode 100755 utils/sanity_checks.rb delete mode 100755 utils/test_integration_all.rb delete mode 100755 utils/test_unit_all.rb diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 9ff421c5..9f1da522 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -5,14 +5,17 @@ # # Copyright (c) 2018-2020 Andre Richter -require_relative '../utils/helpers/copyrighted' +require 'rubygems' +require 'bundler/setup' +require_relative '../utils/devtool/copyright' source_files_exts = ['.S', '.rs', '.rb'] -staged_files = `git --no-pager diff --name-only --cached`.split(/\n/) -staged_files.each do |f| - if f.include?('Makefile') || source_files_exts.include?(File.extname(f)) - puts "Checking for copyright range: #{f}" - exit 1 unless copyrighted?(f) - end +staged_files = `git --no-pager diff --name-only --cached --diff-filter=d`.split(/\n/) +staged_files.select! do |f| + f.include?('Makefile') || + f.include?('Dockerfile') || + source_files_exts.include?(File.extname(f)) end + +exit(1) unless copyright_check_files(staged_files) diff --git a/.github/workflows/build_rpi3.yml b/.github/workflows/build_rpi3.yml index 08c96d9e..ce034f15 100644 --- a/.github/workflows/build_rpi3.yml +++ b/.github/workflows/build_rpi3.yml @@ -35,6 +35,10 @@ jobs: rustup toolchain install nightly --component rust-src llvm-tools-preview rustup default nightly cargo install cargo-xbuild cargo-binutils - - name: Make all + - name: Set up Ruby run: | - ruby utils/make_all.rb rpi3 + gem install bundler + bundle install --retry 3 --with development + - name: Make + run: | + bundle exec ruby utils/devtool.rb make rpi3 diff --git a/.github/workflows/build_rpi4.yml b/.github/workflows/build_rpi4.yml index 6d23070b..52d8bc93 100644 --- a/.github/workflows/build_rpi4.yml +++ b/.github/workflows/build_rpi4.yml @@ -35,6 +35,10 @@ jobs: rustup toolchain install nightly --component rust-src llvm-tools-preview rustup default nightly cargo install cargo-xbuild cargo-binutils - - name: Make all + - name: Set up Ruby run: | - ruby utils/make_all.rb rpi4 + gem install bundler + bundle install --retry 3 --with development + - name: Make + run: | + bundle exec ruby utils/devtool.rb make rpi4 diff --git a/.github/workflows/check_fmt_clippy.yml b/.github/workflows/check_fmt_clippy.yml deleted file mode 100644 index ef3d95b6..00000000 --- a/.github/workflows/check_fmt_clippy.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Formatting + Clippy - -on: - push: - branches: - - master - paths-ignore: - - 'utils/**' - - 'doc/**' - - 'docker/**' - pull_request: - branches: - - master - paths-ignore: - - 'utils/**' - - 'doc/**' - - 'docker/**' - -jobs: - build: - name: Formatter and linter checks - runs-on: ubuntu-18.04 - - steps: - - uses: actions/checkout@v1 - - name: Set up Ruby 2.x - uses: actions/setup-ruby@v1 - with: - ruby-version: 2.x - - name: Set up Rust nightly - run: | - rustup self update - rustup toolchain install nightly --component rustfmt clippy rust-src - rustup default nightly - cargo install cargo-xbuild - - name: Run cargo fmt - run: | - ruby utils/fmt_all.rb --check - - name: Run cargo clippy - run: | - ruby utils/clippy_all.rb diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml new file mode 100644 index 00000000..f9c2787f --- /dev/null +++ b/.github/workflows/sanity.yml @@ -0,0 +1,42 @@ +name: Various Sanity Checks + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + name: Various Sanity Checks + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Set up Ruby 2.x + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.x + - name: Set up Rust nightly + run: | + rustup self update + rustup toolchain install nightly --component rustfmt clippy rust-src + rustup default nightly + cargo install cargo-xbuild + - name: Set up Ruby + run: | + gem install bundler + bundle install --retry 3 --with development + - name: Setup misspell + run: | + curl -L -o ./install-misspell.sh https://git.io/misspell + sh ./install-misspell.sh -b ~/bin + - name: Run checks + run: | + bundle exec ruby utils/devtool.rb clippy + bundle exec ruby utils/devtool.rb copyright + bundle exec ruby utils/devtool.rb fmt_check + bundle exec ruby utils/devtool.rb misspell + bundle exec ruby utils/devtool.rb rubocop diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml deleted file mode 100644 index 458d728c..00000000 --- a/.github/workflows/spelling.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Spelling - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - name: Spelling - - runs-on: ubuntu-18.04 - - steps: - - uses: actions/checkout@v1 - - name: Install misspell and check - run: | - curl -L -o ./install-misspell.sh https://git.io/misspell - sh ./install-misspell.sh -b ~/bin - ~/bin/misspell . diff --git a/.github/workflows/test_integration.yml b/.github/workflows/test_integration.yml index 84d4b858..0de08a47 100644 --- a/.github/workflows/test_integration.yml +++ b/.github/workflows/test_integration.yml @@ -35,6 +35,10 @@ jobs: rustup toolchain install nightly --component rust-src llvm-tools-preview rustup default nightly cargo install cargo-xbuild cargo-binutils + - name: Set up Ruby + run: | + gem install bundler + bundle install --retry 3 --with development - name: Make all run: | - ruby utils/test_integration_all.rb + bundle exec ruby utils/devtool.rb test_integration diff --git a/.github/workflows/test_unit.yml b/.github/workflows/test_unit.yml index cd912565..d7bdfd70 100644 --- a/.github/workflows/test_unit.yml +++ b/.github/workflows/test_unit.yml @@ -35,6 +35,11 @@ jobs: rustup toolchain install nightly --component rust-src llvm-tools-preview rustup default nightly cargo install cargo-xbuild cargo-binutils + - name: Set up Ruby + run: | + gem install bundler + bundle install --retry 3 --with development - name: Make all run: | - ruby utils/test_unit_all.rb + bundle exec ruby utils/devtool.rb test_unit + diff --git a/.gitignore b/.gitignore index 7618b873..c792d20b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ +Gemfile.lock xbuild_sysroot + **/target/* **/.gdb_history + +.bundle +.vendor diff --git a/.rubocop.yml b/.rubocop.yml index f154b675..f9b4e7af 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,7 @@ Layout/IndentationWidth: Width: 4 -Metrics/LineLength: +Layout/LineLength: Max: 100 Metrics/MethodLength: diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..9be40adf --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "editor.formatOnSave": true, + "editor.rulers": [ + 100 + ], +} \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..237ef4be --- /dev/null +++ b/Gemfile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +group :development do + gem 'colorize' + gem 'rubocop', require: false +end diff --git a/contributor_setup.sh b/contributor_setup.sh index 34540a7a..3a5b1e94 100755 --- a/contributor_setup.sh +++ b/contributor_setup.sh @@ -1,3 +1,4 @@ #!/usr/bin/env bash git config core.hooksPath .githooks +bundle install --path .vendor/bundle diff --git a/utils/clean_all.rb b/utils/clean_all.rb deleted file mode 100755 index d08ef1bb..00000000 --- a/utils/clean_all.rb +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -require 'fileutils' -require_relative 'helpers/tutorial_folders.rb' - -def clean_all - crates = tutorial_folders - - crates.each do |x| - x = File.dirname(x) - Dir.chdir(x) do - puts "Cleaning #{x}" - FileUtils.rm_rf('target') - end - end - - FileUtils.rm_rf('xbuild_sysroot') -end - -clean_all if $PROGRAM_NAME == __FILE__ diff --git a/utils/clippy_all.rb b/utils/clippy_all.rb deleted file mode 100755 index bec09723..00000000 --- a/utils/clippy_all.rb +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -require_relative 'helpers/tutorial_folders.rb' - -def clippy_all - crates = tutorial_folders - - crates.each do |x| - x = File.dirname(x) - - Dir.chdir(x) do - puts "Clippy: #{x}" - unless system('make clippy') - puts "\n\nClippy failed!" - exit(1) # Exit with error code - end - end - end -end - -clippy_all if $PROGRAM_NAME == __FILE__ diff --git a/utils/devtool.rb b/utils/devtool.rb new file mode 100755 index 00000000..0b04c9f6 --- /dev/null +++ b/utils/devtool.rb @@ -0,0 +1,215 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# SPDX-License-Identifier: MIT OR Apache-2.0 +# +# Copyright (c) 2020 Andre Richter + +require 'rubygems' +require 'bundler/setup' +require 'colorize' +require 'fileutils' +require_relative 'devtool/copyright' + +# Actions for tutorial folders +class TutorialCrate + attr_reader :folder + + def initialize(folder) + @folder = folder + end + + def tutorial? + /[0-9]/.match?(@folder[0]) + end + + def clean + puts 'Cleaning '.light_blue + @folder + + Dir.chdir(@folder) { FileUtils.rm_rf('target') } + end + + def clippy + puts "Clippy #{@folder}".light_blue + + Dir.chdir(@folder) { exit(1) unless system('make clippy') } + end + + def fmt(args) + print 'Format '.light_blue + print "#{args} ".light_blue unless args.nil? + puts @folder + + Dir.chdir(@folder) { exit(1) unless system("cargo fmt #{args}") } + end + + def make(bsp) + puts "Make #{@folder} - BSP: #{bsp}".light_blue + + Dir.chdir(@folder) { exit(1) unless system("BSP=#{bsp} make") } + end + + def test_unit + return unless testable? + + puts "Unit Tests #{@folder}".light_blue + + Dir.chdir(@folder) { exit(1) unless system('TEST=unit make test') } + end + + def test_integration + return unless testable? + + puts "Integration Tests #{@folder}".light_blue + + Dir.chdir(@folder) do + Dir['tests/*.rs'].sort.each do |t| + t = t.delete_prefix('tests/').delete_suffix('.rs') + exit(1) unless system("TEST=#{t} make test") + end + end + end + + private + + def testable? + Dir.exist?(@folder + '/tests') + end +end + +# Forks commands to all applicable receivers +class DevTool + def initialize + all = Dir['*/Cargo.toml'].sort + + @crates = all.map { |c| TutorialCrate.new(c.delete_suffix('/Cargo.toml')) } + end + + def clean + @crates.each(&:clean) + FileUtils.rm_rf('xbuild_sysroot') + end + + def clippy + @crates.each do |c| + c.clippy + puts + puts + end + end + + def diff + tuts = tutorials.map(&:folder) + padding = tuts.map(&:length).max + + tuts[0..-2].each_with_index do |original, i| + update = tuts[i + 1] + diff_pair(original, update, padding) + end + end + + def fmt(check = false) + args = '-- --check' if check + + @crates.each { |c| c.fmt(args) } + end + + def fmt_check + fmt(true) + end + + def make(bsp = 'rpi3') + bsp = ARGV[1] if ARGV[1] + + @crates.each do |c| + c.make(bsp) + puts + puts + end + end + + def make_xtra + system('cd X1_JTAG_boot && bash update.sh') + end + + def test_unit + @crates.each(&:test_unit) + end + + def test_integration + @crates.each(&:test_integration) + end + + def copyright + exit(1) unless copyright_check_files(copyright_source_files) + end + + def misspell + exit(1) unless system("~/bin/misspell -error #{tracked_files.join(' ')}") + end + + def rubocop + exit(1) unless system('rubocop') + end + + def ready_for_publish + clean + fmt + misspell + rubocop + clippy + copyright + + clean + make('rpi4') + make('rpi3') + make_xtra + test_unit + test_integration + diff + clean + end + + private + + def tutorials + @crates.select(&:tutorial?) + end + + def tracked_files + `git ls-files`.split("\n") + end + + def diff_pair(original, update, padding) + puts 'Diffing '.light_blue + original.ljust(padding) + " -> #{update}" + system("bash utils/diff_tut_folders.bash #{original} #{update}") + end + + def copyright_source_files + extensions = ['.S', '.rs', '.rb'] + + files = tracked_files.select do |f| + f.include?('Makefile') || + f.include?('Dockerfile') || + extensions.include?(File.extname(f)) + end + + files + end +end + +##-------------------------------------------------------------------------------------------------- +## Execution starts here +##-------------------------------------------------------------------------------------------------- +tool = DevTool.new +cmd = ARGV[0] +commands = tool.public_methods(false).sort + +if !commands.include?(cmd&.to_sym) + puts "Usage: ./#{__FILE__} COMMAND" + puts + puts 'Commands:' + commands.each { |m| puts " #{m}" } +else + tool.public_send(cmd) +end diff --git a/utils/devtool/copyright.rb b/utils/devtool/copyright.rb new file mode 100644 index 00000000..5da01256 --- /dev/null +++ b/utils/devtool/copyright.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# SPDX-License-Identifier: MIT OR Apache-2.0 +# +# Copyright (c) 2018-2020 Andre Richter + +require 'colorize' + +def copyright_check_files(source_files) + source_files.sort.each do |f| + puts 'Checking for copyright: '.light_blue + f.to_s + + years = copyright_years(f) + unless years.include?(Time.now.year) + puts "\tOnly found years: #{years}".red + return false + end + end + + true +end + +def copyright_years(file) + years = [] + File.readlines(file).grep(/.*Copyright.*/).each do |x| + years << x.scan(/\d\d\d\d/).map!(&:to_i) + end + + years.flatten +end diff --git a/utils/diff_all.rb b/utils/diff_all.rb deleted file mode 100755 index b2937cb6..00000000 --- a/utils/diff_all.rb +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -require 'fileutils' -require_relative 'helpers/tutorial_folders.rb' - -def diff_all - crates = tutorial_folders(false) - - (0..(crates.length - 2)).each do |i| - old = File.dirname(crates[i]) - new = File.dirname(crates[i + 1]) - puts "Diffing #{old} -> #{new}" - system("bash utils/helpers/diff_tut_folders.bash #{old} #{new}") - end -end - -diff_all if $PROGRAM_NAME == __FILE__ diff --git a/utils/helpers/diff_tut_folders.bash b/utils/diff_tut_folders.bash similarity index 100% rename from utils/helpers/diff_tut_folders.bash rename to utils/diff_tut_folders.bash diff --git a/utils/fmt_all.rb b/utils/fmt_all.rb deleted file mode 100755 index 3d734501..00000000 --- a/utils/fmt_all.rb +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -require_relative 'helpers/tutorial_folders.rb' - -def fmt_all(check = false) - crates = tutorial_folders - - args = if check != false - '-- --check' - else - '' - end - - crates.each do |x| - x = File.dirname(x) - Dir.chdir(x) do - puts "Format #{x}" - unless system("cargo fmt #{args}") - puts "\n\nFmt check failed!" - exit(1) # Exit with error code - end - end - end -end - -if $PROGRAM_NAME == __FILE__ - # Any command line argument means --check - fmt_all(!ARGV[0].nil?) -end diff --git a/utils/helpers/copyrighted.rb b/utils/helpers/copyrighted.rb deleted file mode 100644 index f9657c65..00000000 --- a/utils/helpers/copyrighted.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -def copyrighted?(file) - copyright_years = [] - - File.readlines(file).grep(/.*Copyright.*/).each do |x| - copyright_years << x.scan(/\d\d\d\d/).map!(&:to_i) - end - - copyright_years = copyright_years.flatten.uniq - - unless copyright_years.include?(Time.now.year) - puts "\tHeader: " + copyright_years.inspect - return false - end - - true -end diff --git a/utils/helpers/tutorial_folders.rb b/utils/helpers/tutorial_folders.rb deleted file mode 100755 index 05020101..00000000 --- a/utils/helpers/tutorial_folders.rb +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -require 'fileutils' - -WITH_EXTRA = '[X0-9]' -NO_EXTRA = '[0-9]' - -def tutorial_folders(with_extra = true, testable = false) - crates = Dir['*/Cargo.toml'] - - crates.delete_if do |x| - s = with_extra ? WITH_EXTRA : NO_EXTRA - - !/[#{s}][0-9]/.match?(x[0..1]) - end - - if testable - crates.delete_if do |x| - x[0..1].to_i < 13 - end - end - - crates.sort! -end - -puts tutorial_folders if $PROGRAM_NAME == __FILE__ diff --git a/utils/make_all.rb b/utils/make_all.rb deleted file mode 100755 index e2d2b159..00000000 --- a/utils/make_all.rb +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -require_relative 'helpers/tutorial_folders.rb' - -def make_all(bsp = 'rpi3') - crates = tutorial_folders - - crates.each do |x| - x = File.dirname(x) - puts "\n\n" + x.to_s + "\n\n" - Dir.chdir(x) do - unless system("BSP=#{bsp} make") - puts "\n\nBuild failed!" - exit(1) # Exit with error code - end - end - end -end - -make_all(ARGV[0]) if $PROGRAM_NAME == __FILE__ diff --git a/utils/ready_for_publish.rb b/utils/ready_for_publish.rb deleted file mode 100755 index 5de71f5e..00000000 --- a/utils/ready_for_publish.rb +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -require_relative 'clean_all' -require_relative 'clippy_all' -require_relative 'diff_all' -require_relative 'fmt_all' -require_relative 'make_all' -require_relative 'sanity_checks' -require_relative 'test_integration_all' -require_relative 'test_unit_all' - -clean_all -fmt_all -system('rubocop -l utils') -sanity_checks -clippy_all - -clean_all -make_all -test_unit_all -test_integration_all -system('cd X1_JTAG_boot && bash update.sh') -diff_all -clean_all -system('~/bin/misspell .') diff --git a/utils/sanity_checks.rb b/utils/sanity_checks.rb deleted file mode 100755 index 3bcd6943..00000000 --- a/utils/sanity_checks.rb +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -require_relative 'helpers/copyrighted' -require_relative 'helpers/tutorial_folders.rb' - -def patched? - crates = tutorial_folders - - crates.each do |f| - unless File.readlines(f).grep(/patch.crates-io/).empty? - puts "#{fb} contains patch.crates-io!" - exit(1) - end - end -end - -def check_old_copyrights - sources = Dir.glob('**/*.{S,rs,rb}') + Dir.glob('**/Makefile') - - sources.delete_if do |x| - # if x is not in the index, treat this as an error - !system("git ls-files --error-unmatch #{x}", %i[out err] => File::NULL) - end - - sources.sort.each do |f| - puts "Checking for copyright: #{f}" - exit(1) unless copyrighted?(f) - end -end - -def sanity_checks - patched? - check_old_copyrights -end - -sanity_checks if $PROGRAM_NAME == __FILE__ diff --git a/utils/test_integration_all.rb b/utils/test_integration_all.rb deleted file mode 100755 index 798a1b1a..00000000 --- a/utils/test_integration_all.rb +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -require 'fileutils' -require_relative 'helpers/tutorial_folders.rb' - -def run_tests - Dir['tests/*.rs'].sort.each do |int_test| - int_test = int_test.delete_prefix!('tests/').delete_suffix('.rs') - exit(1) unless system("TEST=#{int_test} make test") - end -end - -def test_integration_all - crates = tutorial_folders(false, true) - - crates.each do |x| - tut = File.dirname(x) - Dir.chdir(tut) do - puts "\n\n" + tut.to_s + "\n\n" - run_tests - end - end -end - -test_integration_all if $PROGRAM_NAME == __FILE__ diff --git a/utils/test_unit_all.rb b/utils/test_unit_all.rb deleted file mode 100755 index 3f77d2e5..00000000 --- a/utils/test_unit_all.rb +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# SPDX-License-Identifier: MIT OR Apache-2.0 -# -# Copyright (c) 2018-2020 Andre Richter - -require 'fileutils' -require_relative 'helpers/tutorial_folders.rb' - -def test_unit_all - crates = tutorial_folders(false, true) - - crates.each do |x| - x = File.dirname(x) - Dir.chdir(x) do - puts "\n\n" + x.to_s + "\n\n" - exit(1) unless system('TEST=unit make test') - end - end -end - -test_unit_all if $PROGRAM_NAME == __FILE__