Repository navigation
Expand file tree
/
Copy pathRakefile
More file actions
73 lines (60 loc) · 2.73 KB
/
Copy pathRakefile
File metadata and controls
73 lines (60 loc) · 2.73 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# frozen-string-literal: true
require 'rake/testtask'
RUBY_WARNING_FLAGS = ['-w'].freeze
STRICT_BLOCK_WARNING_FLAGS = RUBY_VERSION >= '3.4' ? ['-W:strict_unused_block'].freeze : [].freeze
Rake::TestTask.new do |t|
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.warning = true
t.ruby_opts.concat(STRICT_BLOCK_WARNING_FLAGS)
end
task :default => :check
desc 'Run syntax and method-visibility checks, then warning-enabled native tests'
task :check => [:lint, :test]
desc 'Run the syntax and method-visibility checks used by Sequel'
task :lint => [:check_syntax, :check_visibility]
desc 'Check Ruby syntax with warnings (project files only)'
task :check_syntax do
require 'open3'
files = FileList['lib/**/*.rb', 'test/**/*.rb', 'examples/**/*.rb', 'tasks/**/*.rb', '*.gemspec', 'Gemfile', 'Rakefile'].sort
files.each do |file|
stdout, stderr, status = Open3.capture3(RbConfig.ruby, *RUBY_WARNING_FLAGS, *STRICT_BLOCK_WARNING_FLAGS, '-c', file)
next if status.success? && stderr.empty?
warn stdout unless status.success?
warn stderr unless stderr.empty?
abort "Ruby syntax/warning check failed: #{file}"
end
puts "Syntax and warnings checked: #{files.length} project files"
end
desc 'Check adapter method visibility with Jeremy Evans\' visibility_checker'
task :check_visibility do
ruby(*RUBY_WARNING_FLAGS, *STRICT_BLOCK_WARNING_FLAGS, '-Ilib', 'tasks/check_visibility.rb')
end
desc 'Run Sequel upstream SQLite and integration specs (requires tmp/upstream/sequel)'
task :upstream do
ruby(*RUBY_WARNING_FLAGS, *STRICT_BLOCK_WARNING_FLAGS, 'test/upstream.rb')
end
desc 'Run opt-in HTTP/Turso tests using LIBSQL_TEST_URL and LIBSQL_TEST_AUTH_TOKEN'
task :remote do
ruby(*RUBY_WARNING_FLAGS, *STRICT_BLOCK_WARNING_FLAGS, '-Ilib', 'test/remote.rb')
end
desc 'Run the native HTTP tests against the local upstream Hrana fixture'
task :remote_local do
sh({'LIBSQL_TEST_URL' => 'http://localhost:8080', 'LIBSQL_TEST_AUTH_TOKEN' => ''},
'tmp/hrana-venv/bin/python', 'test/support/hrana_server.py',
RbConfig.ruby, *RUBY_WARNING_FLAGS, *STRICT_BLOCK_WARNING_FLAGS, '-Ilib', 'test/remote.rb')
end
desc 'Benchmark embedded libSQL with correctness checks (options: ruby test/performance/run.rb --help)'
task :performance do
ruby 'test/performance/run.rb'
end
namespace :performance do
desc 'Smoke-test all benchmark workloads on libSQL memory/file and SQLite file databases'
task :smoke do
[['libsql', 'memory'], ['libsql', 'file'], ['sqlite', 'file']].each do |adapter, storage|
ruby(*RUBY_WARNING_FLAGS, *STRICT_BLOCK_WARNING_FLAGS, 'test/performance/run.rb',
'--adapter', adapter, '--storage', storage, '--iterations', '2', '--warmup', '1',
'--samples', '1', '--rows', '20', '--batch', '2')
end
end
end