-
-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathRakefile
More file actions
42 lines (34 loc) · 875 Bytes
/
Rakefile
File metadata and controls
42 lines (34 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rake/extensiontask'
require 'rake/testtask'
Rake::ExtensionTask.new('ox') do |ext|
ext.lib_dir = 'lib/ox'
end
def run(command)
if ENV['OX_ASAN']
@ld_preload ||= `gcc -print-file-name=libasan.so`.strip
command = "LD_PRELOAD=#{@ld_preload} ASAN_OPTIONS=detect_leaks=0 #{command}"
end
system command
end
task test_all: [:clean, :compile] do
$stdout.flush
exitcode = 0
status = true
%w[test/tests.rb test/sax/sax_test.rb].each do |test|
cmds = "bundle exec ruby #{test} -v"
$stdout.syswrite "\n#{'#' * 90}\n#{cmds}\n"
Bundler.with_original_env do
status = status && run(cmds)
end
end
exitcode = 1 unless status
unless ENV['OX_ASAN']
Rake::Task['test'].invoke
else
run('rake test')
end
exit(1) if exitcode == 1
end
task default: :test_all