vendor: pull in Chez submodule trees (zuo, nanopass, zlib, lz4, stex)
ober
a1921c871fa6ee504270ef96e99db157aa9622bf
--- a/vendor/ChezScheme/UPSTREAM.md +++ b/vendor/ChezScheme/UPSTREAM.md @@ -13,15 +13,30 @@ relative to upstream `cisco/ChezScheme` that Jerboa depends on. - **Imported:** 2026-05-14 - **Method:** flat snapshot — `.git/` stripped, no history preserved here +### Submodule pins (also flattened, `.git` stripped) + +| Submodule | Upstream | Commit | +| ---------- | --------------------------------------------------------- | ------------------------------------------ | +| `lz4` | https://github.com/lz4/lz4.git | `ebb370ca83af193212df4dcbadcc5d87bc0de2f0` | +| `nanopass` | https://github.com/nanopass/nanopass-framework-scheme.git | `bb47b5695a5bffdfd4d99ec9b349f0864b08e0d4` | +| `stex` | https://github.com/dybvig/stex | `afa607564a5662ffd748e824801277a6b5a3d11c` | +| `zlib` | https://github.com/madler/zlib.git | `da607da739fa6047df13e66a2af6b8bec7c2a498` | +| `zuo` | https://github.com/racket/zuo | `a288cbfe350403899311ca7d8267d570e781ed2c` | + +`.gitmodules` is retained for reference but inert (no submodules registered +in this repo's git index). + ## Updating This is vendored, not a submodule. To sync a newer upstream: ``` rm -rf vendor/ChezScheme -git clone --depth 1 https://git.sr.ht/~lisp/ChezScheme vendor/ChezScheme -rm -rf vendor/ChezScheme/.git -# update Commit/Imported fields above, commit as a single "vendor: sync chez @ <sha>" +git clone --recurse-submodules --shallow-submodules --depth 1 \ + https://git.sr.ht/~lisp/ChezScheme vendor/ChezScheme +find vendor/ChezScheme -name .git -exec rm -rf {} + +# update Commit/Imported fields + submodule SHA table above, +# commit as a single "vendor: sync chez @ <sha>" ``` Local changes (if any) live in `vendor/ChezScheme/` as ordinary files — new file mode 100644 --- /dev/null +++ b/vendor/ChezScheme/lz4/.circleci/config.yml @@ -0,0 +1,75 @@ +# This configuration was automatically generated from a CircleCI 1.0 config. +# It should include any build commands you had along with commands that CircleCI +# inferred from your project structure. We strongly recommend you read all the +# comments in this file to understand the structure of CircleCI 2.0, as the idiom +# for configuration has changed substantially in 2.0 to allow arbitrary jobs rather +# than the prescribed lifecycle of 1.0. In general, we recommend using this generated +# configuration as a reference rather than using it in production, though in most +# cases it should duplicate the execution of your original 1.0 config. +version: 2 +jobs: + build: + working_directory: ~/lz4/lz4 + # Parallelism is broken in this file : it just plays the same tests twice. + # The script will have to be modified to support parallelism properly + # In the meantime, set it to 1. + parallelism: 1 + shell: /bin/bash --login + # CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did. + # If any of these refer to each other, rewrite them so that they don't or see https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables . + environment: + CIRCLE_ARTIFACTS: /tmp/circleci-artifacts + CIRCLE_TEST_REPORTS: /tmp/circleci-test-results + # In CircleCI 1.0 we used a pre-configured image with a large number of languages and other packages. + # In CircleCI 2.0 you can now specify your own image, or use one of our pre-configured images. + # The following configuration line tells CircleCI to use the specified docker image as the runtime environment for you job. + # We have selected a pre-built image that mirrors the build environment we use on + # the 1.0 platform, but we recommend you choose an image more tailored to the needs + # of each job. For more information on choosing an image (or alternatively using a + # VM instead of a container) see https://circleci.com/docs/2.0/executor-types/ + # To see the list of pre-built images that CircleCI provides for most common languages see + # https://circleci.com/docs/2.0/circleci-images/ + docker: + - image: fbopensource/lz4-circleci-primary:0.0.4 + steps: + # Machine Setup + # If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each + # The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out. + - checkout + # Prepare for artifact and test results collection equivalent to how it was done on 1.0. + # In many cases you can simplify this from what is generated here. + # 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/' + - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS + # Test + # This would typically be a build job when using workflows, possibly combined with build + # This is based on your 1.0 configuration file or project settings + - run: CC=clang CFLAGS="-Werror -O0" make all && make clean + - run: c++ -v; make cxxtest && make clean + - run: cc -v; c++ -v; make ctocxxtest && make clean + - run: gcc-5 -v; CC=gcc-5 CFLAGS="-O2 -Werror" make check && make clean + - run: gcc-5 -v; CC=gcc-5 CFLAGS="-O2 -m32 -Werror" CPPFLAGS=-I/usr/include/x86_64-linux-gnu make check && make clean + - run: gcc-6 -v; CC=gcc-6 CFLAGS="-O2 -Werror" make check && make clean + - run: make cmakebuild && make clean + - run: make -C tests test-lz4 + - run: make -C tests test-lz4c + - run: make -C tests test-frametest + - run: make -C tests test-fuzzer && make clean + - run: make -C lib all && make clean + - run: pyenv global 3.4.4; CPPFLAGS=-I/usr/include/x86_64-linux-gnu make versionsTest && make clean + - run: make test-install && make clean + - run: gcc -v; CFLAGS="-O2 -m32 -Werror" CPPFLAGS=-I/usr/include/x86_64-linux-gnu make check && make clean + - run: clang -v; make staticAnalyze && make clean + - run: make platformTest CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static V=1 && make clean + - run: CFLAGS=-m64 LDFLAGS=-m64 make platformTest CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static V=1 && make clean + - run: make platformTest CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static V=1 && make clean + - run: make platformTest CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static V=1 && make clean + # Teardown + # If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each + # Save test results + - store_test_results: + path: /tmp/circleci-test-results + # Save artifacts + - store_artifacts: + path: /tmp/circleci-artifacts + - store_artifacts: + path: /tmp/circleci-test-results new file mode 100644 --- /dev/null +++ b/vendor/ChezScheme/lz4/.circleci/images/primary/Dockerfile @@ -0,0 +1,12 @@ +FROM circleci/buildpack-deps:bionic + +RUN sudo apt-get -y -qq update +RUN sudo apt-get -y install software-properties-common +RUN sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test +RUN sudo apt-get -y install cmake +RUN sudo apt-get -y install qemu-system-ppc qemu-user-static qemu-system-arm +RUN sudo apt-get -y install libc6-dev-armel-cross libc6-dev-arm64-cross libc6-dev-i386 +RUN sudo apt-get -y install clang clang-tools +RUN sudo apt-get -y install gcc-5 gcc-5-multilib gcc-6 +RUN sudo apt-get -y install valgrind +RUN sudo apt-get -y install gcc-multilib-powerpc-linux-gnu gcc-powerpc-linux-gnu gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu new file mode 100644 --- /dev/null +++ b/vendor/ChezScheme/lz4/.cirrus.yml @@ -0,0 +1,9 @@ +task: + name: FreeBSD + freebsd_instance: + matrix: + image_family: freebsd-14-0 + install_script: pkg install -y gmake + script: | + cc -v + gmake test new file mode 100644 --- /dev/null +++ b/vendor/ChezScheme/lz4/.clang-format @@ -0,0 +1,132 @@ +# This is the configuration file for clang-format, an automatic code formatter. +# Introduction: https://clang.llvm.org/docs/ClangFormat.html +# Supported options: https://clang.llvm.org/docs/ClangFormatStyleOptions.html + +Language: Cpp +Standard: Latest + +ColumnLimit: 110 + +UseTab: Never +IndentWidth: 4 +PPIndentWidth: 2 +ContinuationIndentWidth: 4 + +LineEnding: LF +InsertNewlineAtEOF: true +KeepEmptyLinesAtTheStartOfBlocks: false +MaxEmptyLinesToKeep: 1 + +IndentCaseBlocks: false +IndentCaseLabels: false +IndentGotoLabels: false +IndentPPDirectives: AfterHash +IndentWrappedFunctionNames: false + +AlignAfterOpenBracket: Align +AlignArrayOfStructures: Right +AlignEscapedNewlines: Left +AlignOperands: Align +AlignConsecutiveAssignments: + Enabled: true + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveBitFields: + Enabled: true + AcrossEmptyLines: false + AcrossComments: false +AlignConsecutiveDeclarations: + Enabled: true + AcrossEmptyLines: false + AcrossComments: false +AlignConsecutiveMacros: + Enabled: true + AcrossEmptyLines: false + AcrossComments: false +AlignTrailingComments: + Kind: Leave + OverEmptyLines: 0 + +BinPackArguments: true +BinPackParameters: false +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false + +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: AllIfsAndElse +AllowShortLoopsOnASingleLine: false + +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +BraceWrapping: + AfterCaseLabel: false + AfterControlStatement: Never + AfterEnum: false + AfterExternBlock: false + AfterFunction: true + AfterStruct: false + AfterUnion: false + BeforeElse: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false +BreakAfterAttributes: Never +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeInlineASMColon: OnlyMultiline +BreakBeforeTernaryOperators: true + +DerivePointerAlignment: false +PointerAlignment: Left + +QualifierAlignment: Custom +QualifierOrder: ["inline", "static", "volatile", "restrict", "const", "type"] + +ReflowComments: false +BreakStringLiterals: false +RemoveSemicolon: true +RemoveParentheses: ReturnStatement +InsertBraces: false +SeparateDefinitionBlocks: Always + +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeParens: ControlStatements +BitFieldColonSpacing: Both +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpacesBeforeTrailingComments: 1 +SpacesInSquareBrackets: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 + +SortIncludes: Never +IncludeBlocks: Preserve +IncludeIsMainRegex: "" +IncludeCategories: + - {Regex: "<.*>", Priority: -2, CaseSensitive: true} + - {Regex: "\".*\"", Priority: -1, CaseSensitive: true} + +AttributeMacros: ["__capability"] +StatementAttributeLikeMacros: [] +StatementMacros: [] + +PenaltyBreakAssignment: 200 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 10 +PenaltyIndentedWhitespace: 0 +PenaltyReturnTypeOnItsOwnLine: 60 new file mode 100644 --- /dev/null +++ b/vendor/ChezScheme/lz4/.gitattributes @@ -0,0 +1,21 @@ +# Set the default behavior +* text eol=lf + +# Explicitly declare source files +*.c text eol=lf +*.h text eol=lf + +# Denote files that should not be modified. +*.odt binary +*.png binary + +# Visual Studio +*.sln text eol=crlf +*.vcxproj* text eol=crlf +*.vcproj* text eol=crlf +*.suo binary +*.rc text eol=crlf + +# Windows +*.bat text eol=crlf +*.cmd text eol=crlf new file mode 100644 --- /dev/null +++ b/vendor/ChezScheme/lz4/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Expected behavior** +Please describe what you expected to happen. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error '...' +If applicable, add screenshots to help explain your problem. + +**System (please complete the following information):** + - OS: [e.g. Mac] + - Version [e.g. 22] + - Compiler [e.g. gcc] + - Build System [e.g. Makefile] + - Other hardware specs [e.g. Core 2 duo...] + +**Additional context** +Add any other context about the problem here. new file mode 100644 --- /dev/null +++ b/vendor/ChezScheme/lz4/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. new file mode 100644 --- /dev/null +++ b/vendor/ChezScheme/lz4/.github/dependabot.yaml @@ -0,0 +1,7 @@ +version: 2 + +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly new file mode 100644 --- /dev/null +++ b/vendor/ChezScheme/lz4/.github/workflows/README.md @@ -0,0 +1,49 @@ +This directory contains [GitHub Actions](https://github.com/features/actions) workflow files. + +# Known issues + +## USAN, ASAN (`lz4-ubsan-x64`, `lz4-ubsan-x86`, `lz4-asan-x64`) + +For now, `lz4-ubsan-*` uses the `-fsanitize-recover=pointer-overflow` flag: +there are known cases of pointer overflow arithmetic within `lz4.c` fast compression. +These cases are not dangerous with known architecture, +but they are not guaranteed to work by the C standard, +which means that, in some future, some new architecture or some new compiler +may decide to do something funny that could break this behavior. +Hence, in anticipation, it's better to remove them. +This has been already achieved in `lz4hc.c`. +However, the same attempt in `lz4.c` resulted in massive speed losses, +which is not an acceptable cost for preemptively solving a "potential future" problem +not active anywhere today. +Therefore, a more acceptable work-around will have to be found first. + + + +## cppcheck (`lz4-cppcheck`) + +This test script ignores the exit code of `make cppcheck`. +Because this project doesn't 100% follow their recommendation. +Also sometimes it reports false positives. + + + +# Notes + +- You can investigate various information at the right pane of GitHub + Actions report page. + +| Item | Section in the right pane | +| ------------------------- | ------------------------------------- | +| OS, VM | Set up job | +| git repo, commit hash | Run actions/checkout@v2 | +| Version of tools | Environment info | + + + +# Difference with `.travis.yml` + +The following tests are not be included due to limitation of GH-Actions. + +- name: aarch64 real-hw tests +- name: PPC64LE real-hw tests +- name: IBM s390x real-hw tests new file mode 100644 --- /dev/null +++ b/vendor/ChezScheme/lz4/.github/workflows/ci.yml @@ -0,0 +1,828 @@ +# For details, see README.md in this directory. + +############################################################### +# C compilers +# +# - gcc +# - clang +# +# Known Issue +# - All test cases which described as 'fail' must be fixed and replaced with 'true'. +# - gcc-11 (x32, x86) : "../lib/lz4hc.c:148: LZ4HC_countBack: Assertion `(size_t)(match - mMin) < (1U<<31)' failed." +# - all clangs (x32, x86) : "../lib/lz4hc.c:282: int LZ4HC_InsertAndGetWiderMatch(...): Assertion `matchPtr >= lowPrefixPtr' failed." +# +name: lz4 CI +on: [push, pull_request] +permissions: + contents: read + +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.head_ref }} + +jobs: + lz4-c-compilers: + name: CC=${{ matrix.cc }}, ${{ matrix.os }} + strategy: + fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. + matrix: + include: [ + # You can access the following values via ${{ matrix.??? }} + # + # pkgs : apt-get package names. It can include multiple package names which are delimited by space. + # cc : C compiler executable. + # cxx : C++ compiler executable for targets `cxxtest` and `ctocxxtest`. + # x32 : Set 'true' if compiler supports x32. Otherwise, set 'false'. + # Set 'fail' if it supports x32 but fails for now. 'fail' cases must be removed. + # x86 : Set 'true' if compiler supports x86 (-m32). Otherwise, set 'false'. + # Set 'fail' if it supports x86 but fails for now. 'fail' cases must be removed. + # cxxtest : Set 'true' if it can be compiled as C++ code. Otherwise, set 'false'. + # freestanding : Set 'true' if it can be compiled and execute freestanding code. Otherwise, set 'false'. + # Usually, it requires Linux, x86_64 and gcc/g++. + # os : GitHub Actions YAML workflow label. See https://github.com/actions/virtual-environments#available-environments + + # cc + { pkgs: '', cc: cc, cxx: c++, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-latest, }, + + # gcc + { pkgs: '', cc: gcc, cxx: g++, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-latest, }, + # { pkgs: 'gcc-13 g++-13 lib32gcc-13-dev libx32gcc-13-dev', cc: gcc-13, cxx: g++-13, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-22.04, }, + { pkgs: 'gcc-12 g++-12 lib32gcc-12-dev libx32gcc-12-dev', cc: gcc-12, cxx: g++-12, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-22.04, }, + { pkgs: 'gcc-11 g++-11 lib32gcc-11-dev libx32gcc-11-dev', cc: gcc-11, cxx: g++-11, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-22.04, }, + { pkgs: 'gcc-10 g++-10 lib32gcc-10-dev libx32gcc-10-dev', cc: gcc-10, cxx: g++-10, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-22.04, }, + { pkgs: 'gcc-9 g++-9 lib32gcc-9-dev libx32gcc-9-dev', cc: gcc-9, cxx: g++-9, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-22.04, }, + { pkgs: 'gcc-8 g++-8 lib32gcc-8-dev libx32gcc-8-dev', cc: gcc-8, cxx: g++-8, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-20.04, }, + { pkgs: 'gcc-7 g++-7 lib32gcc-7-dev libx32gcc-7-dev', cc: gcc-7, cxx: g++-7, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'true', os: ubuntu-20.04, }, + + # clang + { pkgs: 'lib32gcc-12-dev libx32gcc-12-dev', cc: clang, cxx: clang++, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-latest, }, + { pkgs: 'clang-15 lib32gcc-12-dev libx32gcc-12-dev', cc: clang-15, cxx: clang++-15, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, + { pkgs: 'clang-14 lib32gcc-12-dev libx32gcc-12-dev', cc: clang-14, cxx: clang++-14, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, + { pkgs: 'clang-13 lib32gcc-12-dev libx32gcc-12-dev', cc: clang-13, cxx: clang++-13, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, + { pkgs: 'clang-12 lib32gcc-12-dev libx32gcc-12-dev', cc: clang-12, cxx: clang++-12, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, + { pkgs: 'clang-11 lib32gcc-12-dev libx32gcc-12-dev', cc: clang-11, cxx: clang++-11, x32: 'false', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, + { pkgs: 'clang-10 lib32gcc-10-dev libx32gcc-10-dev', cc: clang-10, cxx: clang++-10, x32: 'fail', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, + { pkgs: 'clang-9 lib32gcc-10-dev libx32gcc-10-dev', cc: clang-9, cxx: clang++-9, x32: 'fail', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, + { pkgs: 'clang-8 lib32gcc-10-dev libx32gcc-10-dev', cc: clang-8, cxx: clang++-8, x32: 'fail', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, + { pkgs: 'clang-7 lib32gcc-7-dev libx32gcc-7-dev', cc: clang-7, cxx: clang++-7, x32: 'fail', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, + { pkgs: 'clang-6.0 lib32gcc-10-dev libx32gcc-10-dev', cc: clang-6.0, cxx: clang++-6.0, x32: 'fail', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, + ] + + runs-on: ${{ matrix.os }} + env: # Set environment variables + # We globally set CC and CXX to improve compatibility + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} + FIXME__LZ4_CI_IGNORE : ' echo Error. But we ignore it for now.' + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install gcc-multilib + sudo apt-get install ${{ matrix.pkgs }} + + - name: Environment info + run: | + echo && type $CC && which $CC && $CC --version + echo && type $CXX && which $CXX && $CXX --version + + - name: make + if: always() + run: make -j V=1 + + - name: install test + if: always() + run: make -C tests test-install V=1 + + - name: make all + if: always() + run: make clean; CFLAGS="-Werror -O0" make -j all V=1 + + - name: make c_standards (C90) + if: always() + run: make clean; make -j c_standards_c90 V=1 + + - name: make c_standards (C11) + if: always() + run: make clean; make -j c_standards_c11 V=1 + + - name: c lib for c++ program + if: ${{ matrix.cxxtest == 'true' }} + run: make clean; make -j ctocxxtest V=1 + + - name: compiled as c++ source + if: ${{ matrix.cxxtest == 'true' }} + run: make clean; make -j cxxtest V=1 + + - name: make test-freestanding + if: ${{ matrix.freestanding == 'true' }} + run: make clean; make test-freestanding V=1 + + - name: make -C programs default -D_FORTIFY_SOURCE=2 + if: always() + run: make clean; CFLAGS='-fPIC' LDFLAGS='-pie -fPIE -D_FORTIFY_SOURCE=2' make -j -C programs default V=1 + + - name: make -C tests test-lz4 + if: always() + run: make clean; CPPFLAGS=-DLZ4IO_NO_TSAN_ONLY make -j V=1 -C tests test-lz4 + + - name: make -C tests test CFLAGS='-mx32' + if: ${{ matrix.x32 == 'true' }} + run: make clean; CFLAGS='-mx32' make -j -C tests test V=1 + + - name: make -C tests test-lz4c32 + if: ${{ matrix.x86 == 'true' }} + run: make clean; CFLAGS='-Werror -O1' make -j -C tests test-lz4c32 V=1 + + + ############################################################### + # # + # Remove this block when we relevant tests run properly # + # # + + - name: make -C tests test CFLAGS='-mx32' || echo Ignore failure for now. + if: ${{ matrix.x32 == 'fail' }} + run: make clean; CFLAGS='-mx32' make -C tests test V=1 || $FIXME__LZ4_CI_IGNORE + + # # + ############################################################### + + + +############################################################### +# LZ4 self tests +# +# - Fullbench +# - Fuzzer +# - LZ4 Frame +# - LZ4 versions +# - Custom LZ4_DISTANCE_MAX +# + lz4-benchmark: + name: Fullbench + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install gcc-multilib + + - name: test-lz4 + run: make -j -C tests test-lz4 V=1 + + - name: test-lz4c + run: make -j -C tests test-lz4c V=1 + + - name: test-lz4c32 + run: make -j -C tests test-lz4c32 V=1 + + - name: test-fullbench + run: make -j -C tests test-fullbench V=1 + + - name: test-fullbench32 + run: make -j -C tests test-fullbench32 V=1 + + + lz4-fuzzer: + name: Fuzzer test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install gcc-multilib + + - name: setup + run: sudo sysctl -w vm.mmap_min_addr=4096 + + - name: fuzzer + run: make -j -C tests test-fuzzer V=1 + + - name: fuzzer32 + run: make -C tests test-fuzzer32 V=1 + + + lz4-standard-makefile-variables: + name: LZ4 Makefile - support for standard variables + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: make standard_variables + run: make standard_variables V=1 + + + lz4-versions: + name: LZ4 versions test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install gcc-multilib + + - name: versionsTest + run: make -j -C tests versionsTest V=1 + + + lz4-abi: + name: LZ4 inter-versions ABI compatibility test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install gcc-multilib + + - name: abiTests + run: make -j -C tests abiTests V=1 + + + lz4-frame: + name: LZ4 frame test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install gcc-multilib + + - name: LZ4 frame test + run: make -j -C tests test-frametest V=1 + + - name: LZ4 frame test (32-bit) + run: make -j -C tests test-frametest32 V=1 + + lz4-memory-usage: + name: test different values of LZ4_MEMORY_USAGE + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + - name: LZ4_MEMORY_USAGE + run: make V=1 -C tests test-compile-with-lz4-memory-usage + + # Custom LZ4_DISTANCE_MAX ; lz4-wlib (CLI linked to dynamic library); LZ4_USER_MEMORY_FUNCTIONS + lz4-custom-distance: + name: Custom LZ4_DISTANCE_MAX + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + - name: custom LZ4_DISTANCE_MAX; test LZ4_USER_MEMORY_FUNCTIONS + run: | + CPPFLAGS='-DLZ4_DISTANCE_MAX=8000' make V=1 check + make clean + make -C programs lz4-wlib V=1 + make clean + make -C tests fullbench-wmalloc V=1 # test LZ4_USER_MEMORY_FUNCTIONS + make clean + CC="c++ -Wno-deprecated" make -C tests fullbench-wmalloc V=1 # stricter function signature check + + # test block device compression #1086 + lz4cli-block-device: + name: Test lz4 compression on a block device + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + - name: create a block device, compress it with lz4 # alternative : blindly use /dev/loop0, seems to always exist + run: | + make lz4 + dd if=/dev/zero of=full0.img bs=2M count=1 + BLOCK_DEVICE=$(sudo losetup --show -fP full0.img) + sudo chmod 666 $BLOCK_DEVICE + ./lz4 -v $BLOCK_DEVICE -c > /dev/null + sudo losetup -d $BLOCK_DEVICE + rm full0.img + + +############################################################### +# Check tools +# +# - cppcheck +# - scan-build +# - valgrind +# - ubsan +# - asan +# - unicode-lint +# - build examples +# + lz4-cppcheck: + name: make cppcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install cppcheck + + - name: Environment info + run: echo && type cppcheck && which cppcheck && cppcheck --version + + - name: cppcheck + # This test script ignores the exit code of cppcheck. + # See known issues in README.md. + run: make V=1 clean cppcheck || echo There are some cppcheck reports but we ignore it. + + + lz4-scan-build: + name: make staticAnalyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install clang-tools + + - name: Environment info + run: | + echo && type gcc && which gcc && gcc --version + echo && type clang && which clang && clang --version + echo && type scan-build && which scan-build # scan-build doesn't have any --version equivalent option + echo && type make && which make && make -v + echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present + + - name: make staticAnalyze + run: make V=1 clean staticAnalyze + + + lz4-valgrind: + name: valgrind + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install valgrind + + - name: Environment info + run: | + echo && type cc && which cc && cc --version + echo && type valgrind && which valgrind && valgrind --version + + - name: valgrind + run: make V=1 -C tests test-mem + + + lz4-ubsan-x64: + name: Linux x64 ubsan + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: ubsan + run: | + make clean + make V=1 usan + + + lz4-ubsan-x86: + name: Linux x86 ubsan + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install gcc-multilib + sudo apt-get install lib32gcc-11-dev + + - name: ubsan32 + run: | + make clean + CC=clang make V=1 usan32 + + + lz4-asan-x64: + name: Linux x64 ASAN + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: setup + run: sudo sysctl -w vm.mmap_min_addr=4096 + + - name: check lz4 + run: make clean; CFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address make -j check V=1 + + - name: frametest + run: make clean; CFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address make -j -C tests test-frametest V=1 + + - name: fuzzer + run: make clean; CFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address make -j -C tests test-fuzzer V=1 + + lz4-msan-x64: + name: Linux x64 MSAN + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: check lz4 + run: make clean; CC=clang CFLAGS=-fsanitize=memory LDFLAGS=-fsanitize=memory make -j check V=1 + + - name: frametest + run: make clean; CC=clang CFLAGS=-fsanitize=memory LDFLAGS=-fsanitize=memory make -j -C tests test-frametest V=1 + + - name: fuzzer + run: make clean; CC=clang CFLAGS=-fsanitize=memory LDFLAGS=-fsanitize=memory make -j -C tests test-fuzzer V=1 + + lz4-tsan-x64: + name: Linux x64 TSAN + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: lz4 cli + run: make clean; CC=clang CPPFLAGS="-fsanitize=thread" make -j -C tests test-lz4 V=1 + + + unicode-lint: + name: lint unicode in ./lib/, ./tests/ and ./programs/ + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + - name: unicode lint + run: bash ./tests/unicode_lint.sh + + lz4-examples: + name: make examples + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + - name: apt-get install + run: | + sudo apt-get update + + - name: Environment info + run: | + echo && type cc && which cc && cc --version + echo && type c++ && which c++ && c++ --version + + - name: examples + run: make V=1 clean examples + + # lasts ~8mn + oss-fuzz: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sanitizer: [address, undefined, memory] + steps: + - name: Build Fuzzers (${{ matrix.sanitizer }}) + id: build + uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master + with: + oss-fuzz-project-name: 'lz4' + dry-run: false + sanitizer: ${{ matrix.sanitizer }} + - name: Run Fuzzers (${{ matrix.sanitizer }}) + uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master + with: + oss-fuzz-project-name: 'lz4' + fuzz-seconds: 300 + dry-run: false + sanitizer: ${{ matrix.sanitizer }} + - name: Upload Crash + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # https://github.com/actions/upload-artifact v4.3.4 + if: failure() && steps.build.outcome == 'success' + with: + name: ${{ matrix.sanitizer }}-artifacts + path: ./out/artifacts + + + +############################################################### +# Platforms +# +# - QEMU (ARM, ARM64, PPC, PPC64LE, S390X) +# - macOS +# - Windows +# + + # QEMU + # All tests use QEMU (static) and gcc cross compiler. + # + lz4-qemu-platforms: + name: QEMU ${{ matrix.type }} + strategy: + fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix instance failed. + matrix: + include: [ + # You can access the following values via ${{ matrix.??? }} + # type : Architecture type for `if:` statement. + # pkgs : apt-get package names. You can include multiple packages which are delimited by space. + # xcc : gcc cross C compiler executable. + # xemu : QEMU static emulator executable. + # os : GitHub Actions YAML workflow label. See https://github.com/actions/virtual-environments#available-environments + + { type: ARM, pkgs: 'qemu-system-arm gcc-arm-linux-gnueabi', xcc: arm-linux-gnueabi-gcc, xemu: qemu-arm-static, os: ubuntu-latest, makevar: "", }, + { type: ARM64, pkgs: 'qemu-system-arm gcc-aarch64-linux-gnu', xcc: aarch64-linux-gnu-gcc, xemu: qemu-aarch64-static, os: ubuntu-latest, makevar: "", }, + { type: PPC, pkgs: 'qemu-system-ppc gcc-powerpc-linux-gnu', xcc: powerpc-linux-gnu-gcc, xemu: qemu-ppc-static, os: ubuntu-latest, makevar: "", }, + { type: PPC64LE, pkgs: 'qemu-system-ppc gcc-powerpc64le-linux-gnu', xcc: powerpc64le-linux-gnu-gcc, xemu: qemu-ppc64le-static, os: ubuntu-latest, makevar: "", }, + { type: S390X, pkgs: 'qemu-system-s390x gcc-s390x-linux-gnu', xcc: s390x-linux-gnu-gcc, xemu: qemu-s390x-static, os: ubuntu-latest, makevar: "", }, + { type: MIPS, pkgs: 'qemu-system-mips gcc-mips-linux-gnu', xcc: mips-linux-gnu-gcc, xemu: qemu-mips-static, os: ubuntu-latest, makevar: "", }, + { type: M68K, pkgs: 'qemu-system-m68k gcc-m68k-linux-gnu', xcc: m68k-linux-gnu-gcc, xemu: qemu-m68k-static, os: ubuntu-latest, makevar: "HAVE_MULTITHREAD=0", }, # bug in MT mode on m68k + { type: RISC-V, pkgs: 'qemu-system-riscv64 gcc-riscv64-linux-gnu', xcc: riscv64-linux-gnu-gcc, xemu: qemu-riscv64-static, os: ubuntu-latest, makevar: "", }, + { type: SPARC, pkgs: 'qemu-system-sparc gcc-sparc64-linux-gnu', xcc: sparc64-linux-gnu-gcc, xemu: qemu-sparc64-static, os: ubuntu-20.04, makevar: "", }, + ] + + runs-on: ${{ matrix.os }} + env: # Set environment variables + XCC: ${{ matrix.xcc }} + XEMU: ${{ matrix.xemu }} + MAKEVAR: ${{ matrix.makevar }} + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: apt-get install + run: | + sudo apt-get update + sudo apt-get install gcc-multilib + sudo apt-get install qemu-utils qemu-user-static + sudo apt-get install ${{ matrix.pkgs }} + + - name: Environment info + run: | + echo && type $XCC && which $XCC && $XCC --version + echo && $XCC -v # Show built-in specs + echo && type $XEMU && which $XEMU && $XEMU --version + + - name: ARM-ARM64-PPC-S390X + if: ${{ matrix.type == 'ARM' || matrix.type == 'ARM64' || matrix.type == 'PPC' || matrix.type == 'S390X'}} + run: make platformTest V=1 CC=$XCC QEMU_SYS=$XEMU + + - name: PPC64LE + if: ${{ matrix.type == 'PPC64LE' }} + run: CFLAGS=-m64 make platformTest V=1 CC=$XCC QEMU_SYS=$XEMU + + - name: MIPS-M68K-RISCV-SPARC + if: ${{ matrix.type == 'MIPS' || matrix.type == 'M68K' || matrix.type == 'RISC-V' || matrix.type == 'SPARC' }} + run: make platformTest V=1 CC=$XCC QEMU_SYS=$XEMU $MAKEVAR + + + + # macOS + lz4-platform-macos-latest: + name: macOS + runs-on: macos-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # https://github.com/actions/checkout v4.1.7 + + - name: Environment info + run: |