diff --git a/llvm-build/README.md b/llvm-build/README.md index 469398843e41144ce9c47f2cbb8e4b41fdaf2e5c..f13e8a2feb81dd06ac94b6a2eeab5d5c39da9543 100644 --- a/llvm-build/README.md +++ b/llvm-build/README.md @@ -203,3 +203,17 @@ Despite all the components provided by LLVM community, we included several tripl For detailed definition of Small System and Standard System, please refer to [System Types](https://gitee.com/openharmony/docs/blob/master/en/device-dev/Readme-EN.md). +### Testing musl libc + +Toolchain build process includes musl libc build. libc.so is available in sysroot. +Sometimes it's needed to build libc tests. + +Here is an example of starting build process on Linux: +``` +# build +python3 ./toolchain/llvm-project/llvm-build/build-libc-test.py +``` + +When build successfully completed, artifacts will be available in `out/llvm_build/musl` directory, including test libraries, libc tests and musl_unittest. +Scripts to execute libc tests could be found in `third_party/musl/scripts` directory. +For detailed information about musl, please refer to [third_party_musl](https://gitee.com/openharmony/third_party_musl). diff --git a/llvm-build/build-libc-test.py b/llvm-build/build-libc-test.py new file mode 100755 index 0000000000000000000000000000000000000000..13be68413d4b3a8f5e0c493de3c5e1679c6ce7d7 --- /dev/null +++ b/llvm-build/build-libc-test.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +# Copyright (C) 2024 Huawei Device Co., Ltd. +# +# 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. + +import os + +from build import BuildConfig, SysrootComposer + +def main(): + print('Start building musl libc tests') + build_config = BuildConfig() + sysroot_composer = SysrootComposer(build_config) + + product_name = 'llvm_build' + target_cpu = 'arm64' + gn_args = '' + + os.chdir(build_config.LLVM_BUILD_DIR) + sysroot_composer.run_hb_build(product_name, target_cpu, 'libctest', gn_args) + sysroot_composer.run_hb_build(product_name, target_cpu, 'libc_gtest', gn_args) + + +if __name__ == "__main__": + main() + + +