[前][次][番号順一覧][スレッド一覧]

ruby-changes:74155

From: nagachika <ko1@a...>
Date: Fri, 21 Oct 2022 14:02:44 +0900 (JST)
Subject: [ruby-changes:74155] 917df81f2e (ruby_3_1): merge revision(s) 24c7e75ded461446e7c8e83bbceecccf7bcb4d0e:

https://git.ruby-lang.org/ruby.git/commit/?id=917df81f2e

From 917df81f2ea5d338b5cc036e97b8f48bf3f8b528 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@r...>
Date: Fri, 21 Oct 2022 12:38:29 +0900
Subject: merge revision(s) 24c7e75ded461446e7c8e83bbceecccf7bcb4d0e:

	test: backfill coverage for MakeMakefile.pkg_config

	---
	 test/mkmf/test_pkg_config.rb | 61 ++++++++++++++++++++++++++++++++++++++++++++
	 1 file changed, 61 insertions(+)
	 create mode 100644 test/mkmf/test_pkg_config.rb
---
 test/mkmf/test_pkg_config.rb | 61 ++++++++++++++++++++++++++++++++++++++++++++
 version.h                    |  2 +-
 2 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 test/mkmf/test_pkg_config.rb

diff --git a/test/mkmf/test_pkg_config.rb b/test/mkmf/test_pkg_config.rb
new file mode 100644
index 0000000000..42aad65cf3
--- /dev/null
+++ b/test/mkmf/test_pkg_config.rb
@@ -0,0 +1,61 @@ https://github.com/ruby/ruby/blob/trunk/test/mkmf/test_pkg_config.rb#L1
+# frozen_string_literal: false
+require_relative 'base'
+require 'shellwords'
+
+class TestMkmf
+  class TestPkgConfig < TestMkmf
+    PKG_CONFIG = find_executable0("pkg-config")
+
+    def setup
+      super
+
+      if PKG_CONFIG
+        @fixtures_dir = File.join(Dir.pwd, "fixtures")
+        @fixtures_lib_dir = File.join(@fixtures_dir, "lib")
+        @fixtures_inc_dir = File.join(@fixtures_dir, "include")
+
+        FileUtils.mkdir(@fixtures_dir)
+        File.write("fixtures/test1.pc", <<~EOF)
+          libdir=#{@fixtures_lib_dir}
+          includedir=#{@fixtures_inc_dir}
+
+          Name: test1
+          Description: Test for mkmf pkg-config method
+          Version: 1.2.3
+          Libs: -L${libdir} -ltest1-public
+          Libs.private: -ltest1-private
+          Cflags: -I${includedir}/cflags-I --cflags-other
+        EOF
+
+        @pkg_config_path, ENV["PKG_CONFIG_PATH"] = ENV["PKG_CONFIG_PATH"], File.join(Dir.pwd, "fixtures")
+      end
+    end
+
+    def teardown
+      if PKG_CONFIG
+        ENV["PKG_CONFIG_PATH"] = @pkg_config_path
+      end
+
+      super
+    end
+
+    def test_pkgconfig_with_option_returns_nil_on_error
+      pend("skipping because pkg-config is not installed") unless PKG_CONFIG
+      assert_nil(pkg_config("package-does-not-exist", "exists"), MKMFLOG)
+    end
+
+    def test_pkgconfig_with_libs_option_returns_output
+      pend("skipping because pkg-config is not installed") unless PKG_CONFIG
+      expected = ["-L#{@fixtures_lib_dir}", "-ltest1-public"].sort
+      actual = pkg_config("test1", "libs").shellsplit.sort
+      assert_equal(expected, actual, MKMFLOG)
+    end
+
+    def test_pkgconfig_with_cflags_option_returns_output
+      pend("skipping because pkg-config is not installed") unless PKG_CONFIG
+      expected = ["--cflags-other", "-I#{@fixtures_inc_dir}/cflags-I"].sort
+      actual = pkg_config("test1", "cflags").shellsplit.sort
+      assert_equal(expected, actual, MKMFLOG)
+    end
+  end
+end
diff --git a/version.h b/version.h
index 486162a528..17a0072e26 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L11
 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
 #define RUBY_VERSION_TEENY 3
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 121
+#define RUBY_PATCHLEVEL 122
 
 #define RUBY_RELEASE_YEAR 2022
 #define RUBY_RELEASE_MONTH 10
-- 
cgit v1.2.3


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]