|
1 | 1 | # frozen_string_literal: true
|
2 | 2 |
|
| 3 | +# We want to run the gumbo test suite using exactly the same compiled gumbo-parser |
| 4 | +# that Nokogiri uses. |
| 5 | +# |
| 6 | +# To that end, we first need to get the Rake ExtensionTask to run extconf.rb which will |
| 7 | +# run the gumbo-parser's configure script. We don't want to compile the extension |
| 8 | +# at this point, so we make `gumbo:test` depend on the Nokogiri Makefile. |
3 | 9 | namespace "gumbo" do
|
4 |
| - # We want to run the gumbo test suite using exactly the same compiled gumbo-parser |
5 |
| - # that Nokogiri uses. |
6 |
| - # |
7 |
| - # To that end, we first need to get the Rake ExtensionTask to run extconf.rb which will |
8 |
| - # run the gumbo-parser's configure script. We don't want to compile the extension |
9 |
| - # at this point, so we make `gumbo:test` depend on the Nokogiri Makefile. |
10 |
| - |
11 |
| - gtest_pkg = "gumbo-parser/googletest" |
12 |
| - host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"] |
13 |
| - host = host.gsub("i386", "i686") |
| 10 | + host = RbConfig::CONFIG["host"] |
14 | 11 | nokogiri_makefile = File.join("tmp/#{RUBY_PLATFORM}/nokogiri/#{RUBY_VERSION}/Makefile")
|
15 | 12 | gumbotest_builddir = "tmp/#{RUBY_PLATFORM}/nokogiri/#{RUBY_VERSION}/tmp/#{host}/ports/libgumbo/1.0.0-nokogiri/libgumbo-1.0.0-nokogiri"
|
16 | 13 | gumbotest_configure = File.absolute_path("gumbo-parser/configure")
|
17 | 14 |
|
| 15 | + gtest_pkg = "gumbo-parser/googletest" |
18 | 16 | file gtest_pkg do
|
19 | 17 | sh(<<~EOF)
|
20 | 18 | curl -L https://github.com/google/googletest/archive/release-1.8.0.tar.gz | \
|
21 | 19 | tar zxf - --strip-components 1 -C gumbo-parser googletest-release-1.8.0/googletest
|
22 | 20 | EOF
|
23 | 21 | end
|
24 | 22 |
|
25 |
| - file gumbotest_configure => gtest_pkg do |
26 |
| - sh("autoreconf", "-fiv", chdir: "gumbo-parser") |
27 |
| - end |
28 |
| - |
29 | 23 | desc "Run the gumbo parser test suite"
|
30 |
| - task "test" => nokogiri_makefile do |
| 24 | + task "test" => [nokogiri_makefile, gtest_pkg] do |
31 | 25 | sh("make", "-j2", "-C", gumbotest_builddir, "check")
|
32 | 26 | end
|
33 | 27 |
|
| 28 | + file gumbotest_configure do |
| 29 | + sh("autoreconf", "-fiv", chdir: "gumbo-parser") |
| 30 | + end |
| 31 | + |
34 | 32 | # Make sure the libgumbo configure script is created before trying to compile the extension.
|
35 | 33 | file nokogiri_makefile => gumbotest_configure
|
36 | 34 |
|
|
0 commit comments