mirror of https://github.com/bazelbuild/rules_cc
Fix internal breakages for `rules_cc`.
PiperOrigin-RevId: 590620989 Change-Id: I2586ea71b477fc5cb75429f8d839c8818d641e8b
This commit is contained in:
parent
05bd7e7e46
commit
db151d0a26
|
@ -1,3 +1,17 @@
|
||||||
|
# Copyright 2023 The Bazel Authors. All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
sh_test(
|
sh_test(
|
||||||
name = "system_library_test",
|
name = "system_library_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
|
|
|
@ -13,11 +13,13 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from py import mock
|
||||||
|
|
||||||
from google.protobuf import text_format
|
from google.protobuf import text_format
|
||||||
from third_party.com.github.bazelbuild.bazel.src.main.protobuf import crosstool_config_pb2
|
from third_party.com.github.bazelbuild.bazel.src.main.protobuf import crosstool_config_pb2
|
||||||
from tools.migration.ctoolchain_comparator_lib import compare_ctoolchains
|
from tools.migration.ctoolchain_comparator_lib import compare_ctoolchains
|
||||||
|
|
||||||
from py from py import mock
|
|
||||||
try:
|
try:
|
||||||
# Python 2
|
# Python 2
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
@ -60,34 +62,53 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
error_toolchain_identifier = (
|
error_toolchain_identifier = (
|
||||||
"Difference in 'toolchain_identifier' field:\n"
|
"Difference in 'toolchain_identifier' field:\n"
|
||||||
"Value before change:\t'first-id'\n"
|
"Value before change:\t'first-id'\n"
|
||||||
"Value after change:\t'second-id'\n")
|
"Value after change:\t'second-id'\n"
|
||||||
error_host_system_name = ("Difference in 'host_system_name' field:\n"
|
)
|
||||||
"Value before change:\t'first-host'\n"
|
error_host_system_name = (
|
||||||
"Value after change:\t'second-host'\n")
|
"Difference in 'host_system_name' field:\n"
|
||||||
error_target_system_name = ("Difference in 'target_system_name' field:\n"
|
"Value before change:\t'first-host'\n"
|
||||||
"Value before change:\t'first-target'\n"
|
"Value after change:\t'second-host'\n"
|
||||||
"Value after change:\t'second-target'\n")
|
)
|
||||||
error_target_cpu = ("Difference in 'target_cpu' field:\n"
|
error_target_system_name = (
|
||||||
"Value before change:\t'first-cpu'\n"
|
"Difference in 'target_system_name' field:\n"
|
||||||
"Value after change:\t'second-cpu'\n")
|
"Value before change:\t'first-target'\n"
|
||||||
error_target_libc = ("Difference in 'target_libc' field:\n"
|
"Value after change:\t'second-target'\n"
|
||||||
"Value before change:\t'first-libc'\n"
|
)
|
||||||
"Value after change:\t'second-libc'\n")
|
error_target_cpu = (
|
||||||
error_compiler = ("Difference in 'compiler' field:\n"
|
"Difference in 'target_cpu' field:\n"
|
||||||
"Value before change:\t'first-compiler'\n"
|
"Value before change:\t'first-cpu'\n"
|
||||||
"Value after change:\t'second-compiler'\n")
|
"Value after change:\t'second-cpu'\n"
|
||||||
error_abi_version = ("Difference in 'abi_version' field:\n"
|
)
|
||||||
"Value before change:\t'first-abi'\n"
|
error_target_libc = (
|
||||||
"Value after change:\t'second-abi'\n")
|
"Difference in 'target_libc' field:\n"
|
||||||
error_abi_libc_version = ("Difference in 'abi_libc_version' field:\n"
|
"Value before change:\t'first-libc'\n"
|
||||||
"Value before change:\t'first-abi-libc'\n"
|
"Value after change:\t'second-libc'\n"
|
||||||
"Value after change:\t'second-abi-libc'\n")
|
)
|
||||||
error_builtin_sysroot = ("Difference in 'builtin_sysroot' field:\n"
|
error_compiler = (
|
||||||
"Value before change is set to 'sysroot'\n"
|
"Difference in 'compiler' field:\n"
|
||||||
"Value after change is not set\n")
|
"Value before change:\t'first-compiler'\n"
|
||||||
error_cc_target_os = ("Difference in 'cc_target_os' field:\n"
|
"Value after change:\t'second-compiler'\n"
|
||||||
"Value before change is not set\n"
|
)
|
||||||
"Value after change is set to 'os'\n")
|
error_abi_version = (
|
||||||
|
"Difference in 'abi_version' field:\n"
|
||||||
|
"Value before change:\t'first-abi'\n"
|
||||||
|
"Value after change:\t'second-abi'\n"
|
||||||
|
)
|
||||||
|
error_abi_libc_version = (
|
||||||
|
"Difference in 'abi_libc_version' field:\n"
|
||||||
|
"Value before change:\t'first-abi-libc'\n"
|
||||||
|
"Value after change:\t'second-abi-libc'\n"
|
||||||
|
)
|
||||||
|
error_builtin_sysroot = (
|
||||||
|
"Difference in 'builtin_sysroot' field:\n"
|
||||||
|
"Value before change is set to 'sysroot'\n"
|
||||||
|
"Value after change is not set\n"
|
||||||
|
)
|
||||||
|
error_cc_target_os = (
|
||||||
|
"Difference in 'cc_target_os' field:\n"
|
||||||
|
"Value before change is not set\n"
|
||||||
|
"Value after change is set to 'os'\n"
|
||||||
|
)
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
|
@ -127,20 +148,26 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
path: "/a/b/c"
|
path: "/a/b/c"
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
error_only_first = ("* List before change contains entries for the "
|
error_only_first = (
|
||||||
"following tools that the list after the change "
|
"* List before change contains entries for the "
|
||||||
"doesn't:\n[only_first]\n")
|
"following tools that the list after the change "
|
||||||
error_only_second = ("* List after change contains entries for the "
|
"doesn't:\n[only_first]\n"
|
||||||
"following tools that the list before the change "
|
)
|
||||||
"doesn't:\n"
|
error_only_second = (
|
||||||
"[\n"
|
"* List after change contains entries for the "
|
||||||
"\tonly_second_1\n"
|
"following tools that the list before the change "
|
||||||
"\tonly_second_2\n"
|
"doesn't:\n"
|
||||||
"]\n")
|
"[\n"
|
||||||
error_paths_differ = ("* Path for tool 'paths_differ' differs before and "
|
"\tonly_second_1\n"
|
||||||
"after the change:\n"
|
"\tonly_second_2\n"
|
||||||
"Value before change:\t'/path/first'\n"
|
"]\n"
|
||||||
"Value after change:\t'/path/second'\n")
|
)
|
||||||
|
error_paths_differ = (
|
||||||
|
"* Path for tool 'paths_differ' differs before and "
|
||||||
|
"after the change:\n"
|
||||||
|
"Value before change:\t'/path/first'\n"
|
||||||
|
"Value after change:\t'/path/second'\n"
|
||||||
|
)
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
|
@ -173,20 +200,26 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
value: "val"
|
value: "val"
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
error_only_first = ("* List before change contains entries for the "
|
error_only_first = (
|
||||||
"following variables that the list after the "
|
"* List before change contains entries for the "
|
||||||
"change doesn't:\n[only_first]\n")
|
"following variables that the list after the "
|
||||||
error_only_second = ("* List after change contains entries for the "
|
"change doesn't:\n[only_first]\n"
|
||||||
"following variables that the list before the "
|
)
|
||||||
"change doesn't:\n"
|
error_only_second = (
|
||||||
"[\n"
|
"* List after change contains entries for the "
|
||||||
"\tonly_second_1\n"
|
"following variables that the list before the "
|
||||||
"\tonly_second_2\n"
|
"change doesn't:\n"
|
||||||
"]\n")
|
"[\n"
|
||||||
error_value_differs = ("* Value for variable 'value_differs' differs before"
|
"\tonly_second_1\n"
|
||||||
" and after the change:\n"
|
"\tonly_second_2\n"
|
||||||
"Value before change:\t'first_value'\n"
|
"]\n"
|
||||||
"Value after change:\t'second_value'\n")
|
)
|
||||||
|
error_value_differs = (
|
||||||
|
"* Value for variable 'value_differs' differs before"
|
||||||
|
" and after the change:\n"
|
||||||
|
"Value before change:\t'first_value'\n"
|
||||||
|
"Value after change:\t'second_value'\n"
|
||||||
|
)
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
|
@ -203,17 +236,19 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
cxx_builtin_include_directory: "d/e/f"
|
cxx_builtin_include_directory: "d/e/f"
|
||||||
cxx_builtin_include_directory: "a/b/c"
|
cxx_builtin_include_directory: "a/b/c"
|
||||||
""")
|
""")
|
||||||
expect_error = ("Difference in 'cxx_builtin_include_directory' field:\n"
|
expect_error = (
|
||||||
"List of elements before change:\n"
|
"Difference in 'cxx_builtin_include_directory' field:\n"
|
||||||
"[\n"
|
"List of elements before change:\n"
|
||||||
"\ta/b/c\n"
|
"[\n"
|
||||||
"\td/e/f\n"
|
"\ta/b/c\n"
|
||||||
"]\n"
|
"\td/e/f\n"
|
||||||
"List of elements after change:\n"
|
"]\n"
|
||||||
"[\n"
|
"List of elements after change:\n"
|
||||||
"\td/e/f\n"
|
"[\n"
|
||||||
"\ta/b/c\n"
|
"\td/e/f\n"
|
||||||
"]\n")
|
"\ta/b/c\n"
|
||||||
|
"]\n"
|
||||||
|
)
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
|
@ -259,32 +294,40 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
extension: '.if.lib'
|
extension: '.if.lib'
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
error_only_first = ("* List before change contains entries for the "
|
error_only_first = (
|
||||||
"following categories that the list after the "
|
"* List before change contains entries for the "
|
||||||
"change doesn't:\n[dynamic_library]\n")
|
"following categories that the list after the "
|
||||||
error_only_second = ("* List after change contains entries for the "
|
"change doesn't:\n[dynamic_library]\n"
|
||||||
"following categories that the list before the "
|
)
|
||||||
"change doesn't:\n"
|
error_only_second = (
|
||||||
"[\n"
|
"* List after change contains entries for the "
|
||||||
"\tinterface_library\n"
|
"following categories that the list before the "
|
||||||
"\tstatic_library\n"
|
"change doesn't:\n"
|
||||||
"]\n")
|
"[\n"
|
||||||
error_extension_differs = ("* Value for category 'object_file' differs "
|
"\tinterface_library\n"
|
||||||
"before and after the change:\n"
|
"\tstatic_library\n"
|
||||||
"Value before change:"
|
"]\n"
|
||||||
"\tprefix:''"
|
)
|
||||||
"\textension:'.obj1'\n"
|
error_extension_differs = (
|
||||||
"Value after change:"
|
"* Value for category 'object_file' differs "
|
||||||
"\tprefix:''"
|
"before and after the change:\n"
|
||||||
"\textension:'.obj2'\n")
|
"Value before change:"
|
||||||
error_prefix_differs = ("* Value for category 'executable' differs "
|
"\tprefix:''"
|
||||||
"before and after the change:\n"
|
"\textension:'.obj1'\n"
|
||||||
"Value before change:"
|
"Value after change:"
|
||||||
"\tprefix:'first'"
|
"\tprefix:''"
|
||||||
"\textension:'.exe'\n"
|
"\textension:'.obj2'\n"
|
||||||
"Value after change:"
|
)
|
||||||
"\tprefix:'second'"
|
error_prefix_differs = (
|
||||||
"\textension:'.exe'\n")
|
"* Value for category 'executable' differs "
|
||||||
|
"before and after the change:\n"
|
||||||
|
"Value before change:"
|
||||||
|
"\tprefix:'first'"
|
||||||
|
"\textension:'.exe'\n"
|
||||||
|
"Value after change:"
|
||||||
|
"\tprefix:'second'"
|
||||||
|
"\textension:'.exe'\n"
|
||||||
|
)
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
|
@ -326,12 +369,16 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
name: 'feature2'
|
name: 'feature2'
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
error_only_first = ("* List before change contains entries for the "
|
error_only_first = (
|
||||||
"following features that the list after the "
|
"* List before change contains entries for the "
|
||||||
"change doesn't:\n[feature1]\n")
|
"following features that the list after the "
|
||||||
error_only_second = ("* List after change contains entries for the "
|
"change doesn't:\n[feature1]\n"
|
||||||
"following features that the list before the "
|
)
|
||||||
"change doesn't:\n[feature2]\n")
|
error_only_second = (
|
||||||
|
"* List after change contains entries for the "
|
||||||
|
"following features that the list before the "
|
||||||
|
"change doesn't:\n[feature2]\n"
|
||||||
|
)
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
|
@ -354,8 +401,9 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after", mock_stdout.getvalue()
|
||||||
|
)
|
||||||
|
|
||||||
def test_feature_provides(self):
|
def test_feature_provides(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -373,8 +421,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after the change:",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after the change:",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_feature_provides_preserves_order(self):
|
def test_feature_provides_preserves_order(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -394,8 +444,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after the change:",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after the change:",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_feature_implies(self):
|
def test_feature_implies(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -412,8 +464,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after the change:",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after the change:",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_feature_implies_preserves_order(self):
|
def test_feature_implies_preserves_order(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -433,8 +487,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after the change:",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after the change:",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_feature_requires_preserves_list_order(self):
|
def test_feature_requires_preserves_list_order(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -462,8 +518,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after the change:",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after the change:",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_feature_requires_ignores_required_features_order(self):
|
def test_feature_requires_ignores_required_features_order(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -509,8 +567,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after the change:",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after the change:",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_action_config_ignores_requires(self):
|
def test_action_config_ignores_requires(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -555,8 +615,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after the change:",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after the change:",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_env_set_ignores_actions_order(self):
|
def test_env_set_ignores_actions_order(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -616,8 +678,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after the change:",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after the change:",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_env_set_env_entries_differ(self):
|
def test_env_set_env_entries_differ(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -645,8 +709,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after the change:",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after the change:",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_feature_preserves_env_set_order(self):
|
def test_feature_preserves_env_set_order(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -686,8 +752,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after the change:",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after the change:",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_action_config_ignores_env_set(self):
|
def test_action_config_ignores_env_set(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -987,10 +1055,13 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after", mock_stdout.getvalue()
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
)
|
||||||
mock_stdout.getvalue())
|
self.assertIn(
|
||||||
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_flag_group_preserves_flags_order(self):
|
def test_flag_group_preserves_flags_order(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1036,10 +1107,13 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after", mock_stdout.getvalue()
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
)
|
||||||
mock_stdout.getvalue())
|
self.assertIn(
|
||||||
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_flag_group_iterate_over_differs(self):
|
def test_flag_group_iterate_over_differs(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1081,10 +1155,13 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after", mock_stdout.getvalue()
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
)
|
||||||
mock_stdout.getvalue())
|
self.assertIn(
|
||||||
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_flag_group_expand_if_true_differs(self):
|
def test_flag_group_expand_if_true_differs(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1126,10 +1203,13 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after", mock_stdout.getvalue()
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
)
|
||||||
mock_stdout.getvalue())
|
self.assertIn(
|
||||||
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_flag_group_expand_if_false_differs(self):
|
def test_flag_group_expand_if_false_differs(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1171,10 +1251,13 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after", mock_stdout.getvalue()
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
)
|
||||||
mock_stdout.getvalue())
|
self.assertIn(
|
||||||
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_flag_group_expand_if_all_available_differs(self):
|
def test_flag_group_expand_if_all_available_differs(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1216,10 +1299,13 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after", mock_stdout.getvalue()
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
)
|
||||||
mock_stdout.getvalue())
|
self.assertIn(
|
||||||
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_flag_group_expand_if_none_available_differs(self):
|
def test_flag_group_expand_if_none_available_differs(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1261,10 +1347,13 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after", mock_stdout.getvalue()
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
)
|
||||||
mock_stdout.getvalue())
|
self.assertIn(
|
||||||
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_flag_group_expand_if_all_available_ignores_order(self):
|
def test_flag_group_expand_if_all_available_ignores_order(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1410,10 +1499,13 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after", mock_stdout.getvalue()
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
)
|
||||||
mock_stdout.getvalue())
|
self.assertIn(
|
||||||
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_flag_group_flag_groups_differ(self):
|
def test_flag_group_flag_groups_differ(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1467,10 +1559,13 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Feature 'feature' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Feature 'feature' differs before and after", mock_stdout.getvalue()
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
)
|
||||||
mock_stdout.getvalue())
|
self.assertIn(
|
||||||
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_action_configs_not_ordered(self):
|
def test_action_configs_not_ordered(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1505,12 +1600,16 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
config_name: 'action2'
|
config_name: 'action2'
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
error_only_first = ("* List before change contains entries for the "
|
error_only_first = (
|
||||||
"following action_configs that the list after the "
|
"* List before change contains entries for the "
|
||||||
"change doesn't:\n[action1]\n")
|
"following action_configs that the list after the "
|
||||||
error_only_second = ("* List after change contains entries for the "
|
"change doesn't:\n[action1]\n"
|
||||||
"following action_configs that the list before the "
|
)
|
||||||
"change doesn't:\n[action2]\n")
|
error_only_second = (
|
||||||
|
"* List after change contains entries for the "
|
||||||
|
"following action_configs that the list before the "
|
||||||
|
"change doesn't:\n[action2]\n"
|
||||||
|
)
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
|
@ -1533,8 +1632,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_action_config_action_name(self):
|
def test_action_config_action_name(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1552,8 +1653,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_action_config_tool_tool_path_differs(self):
|
def test_action_config_tool_tool_path_differs(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1575,8 +1678,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_action_config_tool_execution_requirements_differ(self):
|
def test_action_config_tool_execution_requirements_differ(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1598,8 +1703,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_action_config_tool_execution_requirements_ignores_order(self):
|
def test_action_config_tool_execution_requirements_ignores_order(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1641,8 +1748,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_action_config_implies_preserves_order(self):
|
def test_action_config_implies_preserves_order(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1662,8 +1771,10 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
mock_stdout = StringIO()
|
mock_stdout = StringIO()
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("* Action config 'config' differs before and after",
|
self.assertIn(
|
||||||
mock_stdout.getvalue())
|
"* Action config 'config' differs before and after",
|
||||||
|
mock_stdout.getvalue(),
|
||||||
|
)
|
||||||
|
|
||||||
def test_unused_tool_path(self):
|
def test_unused_tool_path(self):
|
||||||
first = make_toolchain("""
|
first = make_toolchain("""
|
||||||
|
@ -1705,5 +1816,6 @@ class CtoolchainComparatorLibTest(unittest.TestCase):
|
||||||
compare_ctoolchains(first, second)
|
compare_ctoolchains(first, second)
|
||||||
self.assertIn("No difference", mock_stdout.getvalue())
|
self.assertIn("No difference", mock_stdout.getvalue())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue