Ok, any fail makes it go red, now i know

also making command configurable as they seem different on ubuntu (16?) 
than fedora 30 (and who knows where else)
This commit is contained in:
Torsten Rüger 2019-08-18 15:30:52 +03:00
parent 02a4742cc2
commit 6547b1608d
2 changed files with 14 additions and 10 deletions

View File

@ -4,8 +4,6 @@ before_install:
- gem install bundler --version '2.0.1' - gem install bundler --version '2.0.1'
language: ruby language: ruby
script: script:
- qemu-arm -version
- arm-linux-gnu-ld -v
- ruby test/test_all.rb - ruby test/test_all.rb
- bundle exec codeclimate-test-reporter - bundle exec codeclimate-test-reporter
rvm: rvm:

View File

@ -4,7 +4,14 @@ require 'net/scp'
module Mains module Mains
class TestArm < MiniTest::Test class TestArm < MiniTest::Test
@Qemu = "qemu-arm"
@Linker = "arm-linux-gnuabi-ld"
def self.Linker
@Linker
end
def self.Qemu
@Qemu
end
DEBUG = false DEBUG = false
# runnable_methods is called by minitest to determine which tests to run # runnable_methods is called by minitest to determine which tests to run
@ -23,21 +30,20 @@ module Mains
assert_equal stdout , out , "Wrong stdout #{name}" assert_equal stdout , out , "Wrong stdout #{name}"
assert_equal exit_code , code.to_s , "Wrong exit code #{name}" assert_equal exit_code , code.to_s , "Wrong exit code #{name}"
end end
break
end end
tests tests
end end
def self.has_qemu def self.has_qemu
qemu = "qemu-arm"
linker = "arm-linux-gnuabi-ld"
if `uname -a`.include?("torsten") if `uname -a`.include?("torsten")
qemu = "qemu-arm" qemu = "qemu-arm"
linker = "arm-linux-gnu-ld" @Linker = "arm-linux-gnu-ld"
#return false #return false
end end
begin begin
`#{qemu} -version` `#{@Qemu} -version`
`#{linker} -v` `#{@Linker} -v`
rescue => e rescue => e
puts e puts e
return false return false
@ -55,11 +61,11 @@ module Mains
puts "Linking #{name}" if DEBUG puts "Linking #{name}" if DEBUG
`arm-linux-gnu-ld -N mains.o` `#{TestArm.Linker} -N mains.o`
assert_equal 0 , $?.exitstatus , "Linking #{name} failed #{$?}" assert_equal 0 , $?.exitstatus , "Linking #{name} failed #{$?}"
puts "Running #{name}" if DEBUG puts "Running #{name}" if DEBUG
stdout = `qemu-arm ./a.out` stdout = `#{TestArm.Qemu} ./a.out`
exit_code = $?.exitstatus exit_code = $?.exitstatus
puts "Result #{stdout} #{exit_code}" if DEBUG puts "Result #{stdout} #{exit_code}" if DEBUG
return stdout , exit_code return stdout , exit_code