Add Chromium-only Blender WebEngine parity work
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
__all__ = (
|
||||
"main",
|
||||
)
|
||||
|
||||
import unittest
|
||||
|
||||
from check_utils import (
|
||||
ScriptUnitTesting,
|
||||
sliceCommandLineArguments,
|
||||
)
|
||||
|
||||
|
||||
class UnitTesting(ScriptUnitTesting):
|
||||
def test_modulesEnabled(self):
|
||||
self.checkScript("modules_enabled")
|
||||
|
||||
|
||||
def main():
|
||||
# Slice command line arguments by '--'
|
||||
unittest_args, _parser_args = sliceCommandLineArguments()
|
||||
# Construct and run unit tests.
|
||||
unittest.main(argv=unittest_args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
__all__ = (
|
||||
"main",
|
||||
)
|
||||
|
||||
import unittest
|
||||
|
||||
from check_utils import (
|
||||
ScriptUnitTesting,
|
||||
sliceCommandLineArguments,
|
||||
)
|
||||
|
||||
|
||||
class UnitTesting(ScriptUnitTesting):
|
||||
def test_numpyImports(self):
|
||||
self.checkScript("numpy_import")
|
||||
|
||||
def test_numpyBasicOperation(self):
|
||||
self.checkScript("numpy_basic_operation")
|
||||
|
||||
|
||||
def main():
|
||||
# Slice command line arguments by '--'
|
||||
unittest_args, _parser_args = sliceCommandLineArguments()
|
||||
# Construct and run unit tests.
|
||||
unittest.main(argv=unittest_args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
__all__ = (
|
||||
"main",
|
||||
)
|
||||
|
||||
import unittest
|
||||
|
||||
from check_utils import (
|
||||
ScriptUnitTesting,
|
||||
sliceCommandLineArguments,
|
||||
)
|
||||
|
||||
|
||||
class UnitTesting(ScriptUnitTesting):
|
||||
def test_requestsImports(self):
|
||||
self.checkScript("requests_import")
|
||||
|
||||
def test_requestsBasicHttpAccess(self):
|
||||
self.checkScript("requests_basic_access")
|
||||
|
||||
|
||||
def main():
|
||||
# Slice command line arguments by '--'
|
||||
unittest_args, _parser_args = sliceCommandLineArguments()
|
||||
# Construct and run unit tests.
|
||||
unittest.main(argv=unittest_args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
43
blender-5.2.0/tools/check_blender_release/check_release.py
Executable file
43
blender-5.2.0/tools/check_blender_release/check_release.py
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Usage: ./check_release.py -- ../path/to/release/folder
|
||||
__all__ = (
|
||||
"main",
|
||||
)
|
||||
|
||||
import unittest
|
||||
|
||||
import check_module_enabled
|
||||
import check_module_numpy
|
||||
import check_module_requests
|
||||
import check_static_binaries
|
||||
from check_utils import sliceCommandLineArguments
|
||||
|
||||
|
||||
def load_tests(loader, standard_tests, pattern):
|
||||
# Unused.
|
||||
del pattern
|
||||
|
||||
standard_tests.addTests(loader.loadTestsFromTestCase(
|
||||
check_module_enabled.UnitTesting))
|
||||
standard_tests.addTests(loader.loadTestsFromTestCase(
|
||||
check_module_numpy.UnitTesting))
|
||||
standard_tests.addTests(loader.loadTestsFromTestCase(
|
||||
check_module_requests.UnitTesting))
|
||||
standard_tests.addTests(loader.loadTestsFromTestCase(
|
||||
check_static_binaries.UnitTesting))
|
||||
return standard_tests
|
||||
|
||||
|
||||
def main():
|
||||
# Slice command line arguments by '--'
|
||||
unittest_args, _parser_args = sliceCommandLineArguments()
|
||||
# Construct and run unit tests.
|
||||
unittest.main(argv=unittest_args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,226 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
__all__ = (
|
||||
"main",
|
||||
)
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
import unittest
|
||||
import glob
|
||||
|
||||
from check_utils import (
|
||||
sliceCommandLineArguments,
|
||||
parseArguments,
|
||||
)
|
||||
|
||||
|
||||
ALLOWED_LIBS = [
|
||||
# Core C/C++ libraries:
|
||||
"ld-linux.so",
|
||||
"ld-linux-x86-64.so",
|
||||
"libc.so",
|
||||
"libm.so",
|
||||
"libstdc++.so",
|
||||
"libdl.so",
|
||||
"libpthread.so",
|
||||
"libgcc_s.so",
|
||||
"librt.so",
|
||||
"libutil.so",
|
||||
|
||||
# Libraries which are part of default install:
|
||||
"libcrypt.so",
|
||||
"libuuid.so",
|
||||
|
||||
# Bundled Python NCURSES dependencies.
|
||||
"libpanelw.so",
|
||||
"libncursesw.so",
|
||||
"libtinfo.so",
|
||||
|
||||
# X11 libraries we don't link statically:
|
||||
"libdrm.so",
|
||||
"libX11.so",
|
||||
"libXext.so",
|
||||
"libXrender.so",
|
||||
"libXxf86vm.so",
|
||||
"libXi.so",
|
||||
"libXfixes.so",
|
||||
"libxkbcommon.so",
|
||||
|
||||
# MaterialX X11 libs:
|
||||
"libICE.so",
|
||||
"libSM.so",
|
||||
"libXt.so",
|
||||
"libOpenGL.so",
|
||||
"libGLX.so",
|
||||
|
||||
# Level Zero (Intel GPU Render)
|
||||
"libze_loader.so",
|
||||
|
||||
# OpenGL libraries:
|
||||
"libGL.so",
|
||||
"libGLU.so",
|
||||
|
||||
# Library the software-GL is linking against and distributes with it:
|
||||
'libglapi.so',
|
||||
'libxcb.so',
|
||||
]
|
||||
|
||||
IGNORE_FILES = ("blender-launcher", )
|
||||
IGNORE_EXTENSION = (".sh", ".py", )
|
||||
|
||||
|
||||
# Library dependencies.
|
||||
|
||||
def getNeededLibrariesLDD(binary_filepath):
|
||||
"""
|
||||
This function uses ldd to collect libraries which binary depends on.
|
||||
|
||||
Not totally safe since ldd might actually execute the binary to get it's
|
||||
symbols and will also collect indirect dependencies which might not be
|
||||
desired.
|
||||
|
||||
Has advantage of telling that some dependency library is not found.
|
||||
"""
|
||||
ldd_command = ("ldd", str(binary_filepath))
|
||||
ldd_output = subprocess.check_output(ldd_command, stderr=subprocess.STDOUT)
|
||||
lines = ldd_output.decode().split("\n")
|
||||
libraries = []
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
lib_name = line.split("=>")[0]
|
||||
lib_name = lib_name.split(" (")[0].strip()
|
||||
lib_file_name = os.path.basename(lib_name)
|
||||
libraries.append(lib_file_name)
|
||||
return libraries
|
||||
|
||||
|
||||
def getNeededLibrariesOBJDUMP(binary_filepath):
|
||||
"""
|
||||
This function uses objdump to get direct dependencies of a given binary.
|
||||
|
||||
Totally safe, but will require manual check over libraries which are not
|
||||
found on the system.
|
||||
"""
|
||||
objdump_command = ("objdump", "-p", str(binary_filepath))
|
||||
objdump_output = subprocess.check_output(objdump_command,
|
||||
stderr=subprocess.STDOUT)
|
||||
lines = objdump_output.decode().split("\n")
|
||||
libraries = []
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
if not line.startswith("NEEDED"):
|
||||
continue
|
||||
lib_name = line[6:].strip()
|
||||
libraries.append(lib_name)
|
||||
return libraries
|
||||
|
||||
|
||||
def getNeededLibraries(binary_filepath):
|
||||
"""
|
||||
Get all libraries given binary depends on.
|
||||
"""
|
||||
if False:
|
||||
return getNeededLibrariesLDD(binary_filepath)
|
||||
else:
|
||||
return getNeededLibrariesOBJDUMP(binary_filepath)
|
||||
|
||||
|
||||
def stripLibraryABI(lib_name):
|
||||
"""
|
||||
Strip ABI suffix from .so file
|
||||
|
||||
Example; ``libexample.so.1.0`` => ``libexample.so``.
|
||||
"""
|
||||
lib_name_no_abi = lib_name
|
||||
# TODO(sergey): Optimize this!
|
||||
while True:
|
||||
no_abi = re.sub(r"\.[0-9]+$", "", lib_name_no_abi)
|
||||
if lib_name_no_abi == no_abi:
|
||||
break
|
||||
lib_name_no_abi = no_abi
|
||||
return lib_name_no_abi
|
||||
|
||||
|
||||
class UnitTesting(unittest.TestCase):
|
||||
def checkBinary(self, binary_filepath):
|
||||
"""
|
||||
Check given binary file to be a proper static self-sufficient.
|
||||
"""
|
||||
|
||||
libraries = getNeededLibraries(binary_filepath)
|
||||
for lib_name in libraries:
|
||||
lib_name_no_abi = stripLibraryABI(lib_name)
|
||||
with self.subTest(msg=os.path.basename(binary_filepath) + ' check'):
|
||||
self.assertTrue(lib_name_no_abi in ALLOWED_LIBS,
|
||||
"Error detected in {}: library used {}" . format(
|
||||
binary_filepath, lib_name))
|
||||
|
||||
def checkDirectory(self, directory):
|
||||
"""
|
||||
Recursively traverse directory and check every binary in.
|
||||
"""
|
||||
|
||||
for path in Path(directory).rglob("*"):
|
||||
# Ignore any checks on directory.
|
||||
if path.is_dir():
|
||||
continue
|
||||
# Ignore script files.
|
||||
if path.name in IGNORE_FILES:
|
||||
continue
|
||||
if path.suffix in IGNORE_EXTENSION:
|
||||
continue
|
||||
# Check any executable binary,
|
||||
if path.stat().st_mode & 0o111 != 0:
|
||||
self.checkBinary(path)
|
||||
# Check all dynamic libraries.
|
||||
elif path.suffix == ".so":
|
||||
self.checkBinary(path)
|
||||
|
||||
def test_directoryIsStatic(self):
|
||||
# Parse arguments which are not handled by unit testing framework.
|
||||
args = parseArguments()
|
||||
# Do some sanity checks first.
|
||||
self.assertTrue(os.path.exists(args.directory),
|
||||
"Given directory does not exist: {}" .
|
||||
format(args.directory))
|
||||
self.assertTrue(os.path.isdir(args.directory),
|
||||
"Given path is not a directory: {}" .
|
||||
format(args.directory))
|
||||
# Add sanitizer libraries if needed.
|
||||
if args.is_sanitizer_build:
|
||||
ALLOWED_LIBS.extend([
|
||||
"libasan.so",
|
||||
"libubsan.so",
|
||||
])
|
||||
# Add all libraries the we bundle to the allowed list
|
||||
ALLOWED_LIBS.extend(glob.glob("*.so", root_dir=args.directory + "/lib"))
|
||||
# Add OIDN libs that do not have an `.so` symbolic-link.
|
||||
for oidn_lib in glob.glob("libOpenImageDenoise_*.so*", root_dir=args.directory + "/lib"):
|
||||
ALLOWED_LIBS.append(stripLibraryABI(oidn_lib))
|
||||
# Add all bundled python libs
|
||||
for python_lib in glob.glob("[0-9].[0-9]/python/lib/**/*.so", root_dir=args.directory, recursive=True):
|
||||
ALLOWED_LIBS.append(os.path.basename(python_lib))
|
||||
|
||||
# Perform actual test,
|
||||
self.checkDirectory(args.directory)
|
||||
|
||||
|
||||
def main():
|
||||
# Slice command line arguments by '--'
|
||||
unittest_args, _parser_args = sliceCommandLineArguments()
|
||||
# Construct and run unit tests.
|
||||
unittest.main(argv=unittest_args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
86
blender-5.2.0/tools/check_blender_release/check_utils.py
Normal file
86
blender-5.2.0/tools/check_blender_release/check_utils.py
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
__all__ = (
|
||||
"ScriptUnitTesting",
|
||||
"parseArguments",
|
||||
"sliceCommandLineArguments",
|
||||
)
|
||||
|
||||
import unittest
|
||||
|
||||
|
||||
def sliceCommandLineArguments():
|
||||
"""
|
||||
Slice command line arguments by -- argument.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
double_shasl_index = sys.argv.index("--")
|
||||
except ValueError:
|
||||
unittest_args = sys.argv[:]
|
||||
parser_args = []
|
||||
else:
|
||||
unittest_args = sys.argv[:double_shasl_index]
|
||||
parser_args = sys.argv[double_shasl_index + 1:]
|
||||
|
||||
return unittest_args, parser_args
|
||||
|
||||
|
||||
def parseArguments():
|
||||
import argparse
|
||||
|
||||
# Construct argument parser.
|
||||
parser = argparse.ArgumentParser(description="Static binary checker")
|
||||
parser.add_argument('--directory', help='Directories to check')
|
||||
# ASAN builds link additional libraries, so check_static_binaries.py needs to know about it.
|
||||
parser.add_argument(
|
||||
'--sanitizer-build',
|
||||
dest='is_sanitizer_build',
|
||||
action='store_true',
|
||||
help='Whether the checked binaries were built with the sanitizer option (`WITH_COMPILER_ASAN` CMake option)')
|
||||
# Parse arguments which are not handled by unit testing framework.
|
||||
unittest_args, parser_args = sliceCommandLineArguments()
|
||||
args = parser.parse_args(args=parser_args)
|
||||
# TODO(sergey): Run some checks here?
|
||||
return args
|
||||
|
||||
|
||||
def runScriptInBlender(blender_directory, script):
|
||||
"""
|
||||
Run given script inside Blender and check non-zero exit code
|
||||
"""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
blender = os.path.join(blender_directory, "blender")
|
||||
python = os.path.join(os.path.dirname(__file__), "scripts", script) + ".py"
|
||||
|
||||
command = (blender,
|
||||
"-b",
|
||||
"--factory-startup",
|
||||
"--python-exit-code", "1",
|
||||
"--python", python)
|
||||
|
||||
process = subprocess.Popen(command,
|
||||
shell=False,
|
||||
text=True,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.PIPE)
|
||||
_, error = process.communicate()
|
||||
return process.returncode == 0, error
|
||||
|
||||
|
||||
class ScriptUnitTesting(unittest.TestCase):
|
||||
def checkScript(self, script):
|
||||
# Parse arguments which are not handled by unit testing framework.
|
||||
args = parseArguments()
|
||||
# Perform actual test,
|
||||
returncode, error = runScriptInBlender(args.directory, script)
|
||||
self.assertTrue(returncode,
|
||||
f"Failed to run script {script} in Blender.\nError output:\n{error}")
|
||||
@@ -0,0 +1,9 @@
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import _sha1
|
||||
import _sha2
|
||||
import _md5
|
||||
import ssl
|
||||
import multiprocessing.synchronize
|
||||
@@ -0,0 +1,10 @@
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# This code tests bug reported in #50703
|
||||
|
||||
import numpy
|
||||
|
||||
a = numpy.array([[3, 2, 0], [3, 1, 0]], dtype=numpy.int32)
|
||||
a[0]
|
||||
@@ -0,0 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import numpy
|
||||
@@ -0,0 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import requests
|
||||
|
||||
# Test this specific endpoint because this will check for a connection to the
|
||||
# buildbot master. We should be quite sure that this endpoint is up if the
|
||||
# builder is running the release check scripts.
|
||||
website = "https://builder.blender.org/admin/"
|
||||
|
||||
r = requests.get(website, verify=True, timeout=30)
|
||||
|
||||
assert r.status_code == 200, f"{website} returned a status code {r.status_code}, we expected 200"
|
||||
assert r.reason == "OK", f"Didn't get 'OK' response from {website}, got {r.reason}"
|
||||
assert len(r.content) > 256, "The content we got from the web request is too small to be valid"
|
||||
@@ -0,0 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import requests
|
||||
Reference in New Issue
Block a user