mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-18 20:27:53 +00:00
f19463ece2
* Handle objs in Ruby code * Add task to make Makefile * Share commont constance in test suites * Add model-related APIs * Add Whisper::Model class * Add tests for Whisper::Model * Add missing LDFLAG -lstdc++ * Add tests for Whisper.log_set * Add Whisper.set_log * Define log level * Add document on logging * Add license section to README * Add document on Whisper::Model * Fix examples in README * Add test for Model with GC * Make dependency on Makefile more accurate * Fix bug about Whisper::Model and GC
32 lines
933 B
Ruby
32 lines
933 B
Ruby
require_relative "helper"
|
|
require 'tempfile'
|
|
require 'tmpdir'
|
|
require 'shellwords'
|
|
|
|
class TestPackage < TestBase
|
|
def test_build
|
|
Tempfile.create do |file|
|
|
assert system("gem", "build", "whispercpp.gemspec", "--output", file.to_path.shellescape, exception: true)
|
|
assert file.size > 0
|
|
assert_path_exist file.to_path
|
|
end
|
|
end
|
|
|
|
sub_test_case "Building binary on installation" do
|
|
def setup
|
|
system "rake", "build", exception: true
|
|
end
|
|
|
|
def test_install
|
|
match_data = `rake -Tbuild`.match(/(whispercpp-(.+)\.gem)/)
|
|
filename = match_data[1]
|
|
version = match_data[2]
|
|
basename = "whisper.#{RbConfig::CONFIG["DLEXT"]}"
|
|
Dir.mktmpdir do |dir|
|
|
system "gem", "install", "--install-dir", dir.shellescape, "pkg/#{filename.shellescape}", exception: true
|
|
assert_path_exist File.join(dir, "gems/whispercpp-#{version}/lib", basename)
|
|
end
|
|
end
|
|
end
|
|
end
|