From 16df642c2a417b5b6dde3eae2305f2a67ad0eebf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 5 Sep 2024 12:51:17 +1000 Subject: [PATCH] Tests: exclude big-endian tests on macOS In preparation for adding big-endian tests, disable them on macOS where many are failing, although it looks like the cause of failure may not relate to endian conversion, it needs further investigation. --- tests/python/bl_blendfile_versioning.py | 33 ++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/tests/python/bl_blendfile_versioning.py b/tests/python/bl_blendfile_versioning.py index 4da37acbb6c..b45d9f5d919 100644 --- a/tests/python/bl_blendfile_versioning.py +++ b/tests/python/bl_blendfile_versioning.py @@ -3,10 +3,12 @@ # SPDX-License-Identifier: Apache-2.0 # ./blender.bin --background --python tests/python/bl_blendfile_versioning.py .. -import bpy import os +import platform import sys +import bpy + sys.path.append(os.path.dirname(os.path.realpath(__file__))) from bl_blendfile_utils import TestHelper @@ -43,6 +45,21 @@ class TestBlendFileOpenAllTestFiles(TestHelper): "ram_glsl.blend", } + # Directories to exclude relative to `./tests/data/`. + self.excluded_dirs = () + + if platform.system() == "Darwin": + self.excluded_dirs = ( + *self.excluded_dirs, + # The assert in `BKE_libblock_alloc_in_lib` often fails: + # `BLI_assert(bmain->is_locked_for_linking == false || ELEM(type, ID_WS, ID_GR, ID_NT))`. + # This needs to be investigated. + "io_tests/blend_big_endian/", + ) + + assert all(p.endswith("/") for p in self.excluded_dirs) + self.excluded_dirs = tuple(p.replace("/", os.sep) for p in self.excluded_dirs) + # Generate the slice of blendfile paths that this instance of the test should process. blendfile_paths = [p for p in self.iter_blendfiles_from_directory(self.args.src_test_dir)] # `os.scandir()` used by `iter_blendfiles_from_directory` does not @@ -73,16 +90,26 @@ class TestBlendFileOpenAllTestFiles(TestHelper): slice_indices = [(gen_indices(i), gen_indices(i + 1)) for i in range(slice_range)] return slice_indices[slice_index] + def skip_path_check(self, bfp): + if os.path.basename(bfp) in self.excluded_paths: + return True + if self.excluded_dirs: + assert bfp.startswith(self.args.src_test_dir) + bfp_relative = bfp[len(self.args.src_test_dir):].rstrip(os.sep) + if bfp_relative.startswith(*self.excluded_dirs): + return True + return False + def test_open(self): for bfp in self.blendfile_paths: - if os.path.basename(bfp) in self.excluded_paths: + if self.skip_path_check(bfp): continue bpy.ops.wm.read_homefile(use_empty=True, use_factory_startup=True) bpy.ops.wm.open_mainfile(filepath=bfp, load_ui=False) def link_append(self, do_link): for bfp in self.blendfile_paths: - if os.path.basename(bfp) in self.excluded_paths: + if self.skip_path_check(bfp): continue bpy.ops.wm.read_homefile(use_empty=True, use_factory_startup=True) with bpy.data.libraries.load(bfp, link=do_link) as (lib_in, lib_out):