初始化内容
This commit is contained in:
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
# Packit
|
||||
|
||||
This document is to use [Packit CI][Packit] that enables us to test SIMDe on Fedora project's native CPU environments, x86_64, i686, aarch64, ppc64le and s390x as of June 2023. Packit CI can be executed on pull-request and push, and create a RPM package based on the specified RPM spec (recipe) file, then run commands in the `%check` section in the RPM spec file in the environments. We use a minimal RPM spec file only to run tests on the environments.
|
||||
|
||||
## Motivation and context
|
||||
|
||||
We want to keep [Fedora rawhide][Fedora rawhide] cases in the CI. Fedora rawhide is the latest development version of Fedora Linux, not a named release that might go out of support later. Because the gcc and clang new versions are landing on Fedora rawhide earlier than other Linux distributions.
|
||||
|
||||
## How to check the CI results
|
||||
|
||||
1. Enable Packit CI for your forked simde repository. See the [onboarding guide][Packit guide]
|
||||
2. When you push branches to your repository, the CI is triggered. Go to the [Pipelines][Packit pipelines] page to see your pipeline.
|
||||
3. Do browser-search by "simde".
|
||||
4. Click a "fedora-\*-\*" button on the Jobs to go to the job detailed page.
|
||||
5. You can see 3 links below. You can check the Build Logs first, and the SRPM Logs second if it is necessary.
|
||||
* **SRPM Logs**: A log of the preparation of the test such as installing the used RPM packages to test. This is a log that the system creates Source RPM (SRPM) from the RPM spec file.
|
||||
* **Web URL**: Go to the jobs page in Fedora Copr web system used to run the RPM.
|
||||
* **Build Logs**: It includes the testing log and the result. This is a log that the system builds a RPM package from the SRPM. The tests are executed in a part of the processes.
|
||||
|
||||
## Customize the CI
|
||||
|
||||
* `.packit.yml`
|
||||
* You can customize the executed CPU pipelines at the `jobs - targets`, when you see infra issues in the specific CPU pipelines.
|
||||
* `.packit/ci.sh`
|
||||
* You can customize if the CI fails when the tests fail at the "Customized constants" section.
|
||||
* You can customize the tests to be executed to save the CI's total running time at the "Customized constants" section.
|
||||
|
||||
You can check the [configuration document][Packit configuration] for details.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you experience issues related to Packit, you can try the following things:
|
||||
|
||||
* Check [Packit status page][Packit status].
|
||||
* Check [Packit pipeline page][Packit pipelines] to check how your application and other applications are running.
|
||||
* Go to [Packit issues page][Packit issues] to open bugs or feature requests.
|
||||
* Contact Packet team. You can contact by their communication channels (Element, Matrix, IRC, Email, and Mastodon) written in [Packit top page][Packit] footer area - Contact.
|
||||
|
||||
[Packit]: https://packit.dev/
|
||||
[Packit configuration]: https://packit.dev/docs/configuration
|
||||
[Packit guide]: https://packit.dev/docs/guide/
|
||||
[Packit issues]: https://github.com/packit/packit/issues
|
||||
[Packit pipelines]: https://dashboard.packit.dev/pipelines
|
||||
[Packit status]: https://status.packit.dev/
|
||||
[Fedora rawhide]: https://docs.fedoraproject.org/en-US/releases/rawhide/
|
||||
Vendored
+215
@@ -0,0 +1,215 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
# Define variables
|
||||
HOST_CPU="$(uname -m)"
|
||||
JOBS="$(nproc)"
|
||||
|
||||
# Functions
|
||||
function _time {
|
||||
/bin/time -f '=> [%E]' ${@}
|
||||
}
|
||||
|
||||
function _setup {
|
||||
if ! meson setup "${BUILD_DIR}"; then
|
||||
cat "${BUILD_DIR}/meson-logs/meson-log.txt"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function _build {
|
||||
rm -f build.log
|
||||
if ! _time ninja -C "${BUILD_DIR}" -v -j "${JOBS}" >& build.log; then
|
||||
cat build.log
|
||||
return 1
|
||||
fi
|
||||
head -4 build.log
|
||||
tail -3 build.log
|
||||
}
|
||||
|
||||
function _test {
|
||||
if ! _time meson test -C "${BUILD_DIR}" \
|
||||
-q --no-rebuild --print-errorlogs; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function _run_test {
|
||||
if ! _setup; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! _build; then
|
||||
return 2
|
||||
fi
|
||||
|
||||
if ! _test; then
|
||||
return 3
|
||||
fi
|
||||
}
|
||||
|
||||
function _run_test_and_get_result {
|
||||
local exit_status=0
|
||||
local result="skipped"
|
||||
|
||||
if [ "${#}" -lt 1 ]; then
|
||||
echo "Argument error" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
local cond="${1}"
|
||||
|
||||
if [ "${cond}" = "include" ] || [ "${cond}" = "pend" ]; then
|
||||
if _run_test; then
|
||||
if [ "${cond}" = "include" ]; then
|
||||
result="ok"
|
||||
else
|
||||
exit_status=1
|
||||
result="pending - passed unexpectedly"
|
||||
fi
|
||||
else
|
||||
if [ "${cond}" = "include" ]; then
|
||||
exit_status=1
|
||||
result="not ok"
|
||||
else
|
||||
result="pending - failed expectedly"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Use global variables to pass the return values as a limitation of Bash.
|
||||
result_buf="${result}"
|
||||
return "${exit_status}"
|
||||
}
|
||||
|
||||
# Print system info.
|
||||
cat /proc/cpuinfo
|
||||
cat /proc/meminfo
|
||||
|
||||
# Set PATH for commands installed by `pip install`.
|
||||
PATH="${PATH}:${HOME}/.local/bin"
|
||||
|
||||
# Install additional packages.
|
||||
pip3 install -U meson
|
||||
|
||||
# Run test.
|
||||
|
||||
# Configuration
|
||||
#
|
||||
# If the value is true, the CI returns the exit status zero even if the tests
|
||||
# fail as a compromised way.
|
||||
IGNORE_EXIT_STATUS=
|
||||
|
||||
# Define the testing matrix.
|
||||
# "include": Include the test in the matrix. Run the test.
|
||||
# "exclude": Exclude the test. The test is not executed.
|
||||
# It can be used to save the total running time in CI.
|
||||
# "pend" : Run the test, but if the test fails, it passes as exit status zero.
|
||||
# If the test passes unexpectedly, it fails as exit status non-zero.
|
||||
#
|
||||
# Set the default behavior for each test.
|
||||
MATRIX_DEFAULT_GCC_DEFAULT="exclude"
|
||||
MATRIX_DEFAULT_GCC_O2="include"
|
||||
MATRIX_DEFAULT_GCC_RPM="exclude"
|
||||
MATRIX_DEFAULT_CLANG_DEFAULT="exclude"
|
||||
MATRIX_DEFAULT_CLANG_O2="include"
|
||||
MATRIX_DEFAULT_CLANG_RPM="exclude"
|
||||
# Set the CPU specific behavior for each test optionally.
|
||||
# This configuration is prioritized than the default behavior.
|
||||
|
||||
# End of configuration
|
||||
|
||||
# Generate the current CPU specific test conditions.
|
||||
# If there is no CPU specific variable, set the default value.
|
||||
TEST_COND_GCC_DEFAULT=$(eval echo \
|
||||
"\${MATRIX_${HOST_CPU}_GCC_DEFAULT:-${MATRIX_DEFAULT_GCC_DEFAULT}}")
|
||||
TEST_COND_GCC_O2=$(eval echo \
|
||||
"\${MATRIX_${HOST_CPU}_GCC_O2:-${MATRIX_DEFAULT_GCC_O2}}")
|
||||
TEST_COND_GCC_RPM=$(eval echo \
|
||||
"\${MATRIX_${HOST_CPU}_GCC_RPM:-${MATRIX_DEFAULT_GCC_RPM}}")
|
||||
TEST_COND_CLANG_DEFAULT=$(eval echo \
|
||||
"\${MATRIX_${HOST_CPU}_CLANG_DEFAULT:-${MATRIX_DEFAULT_CLANG_DEFAULT}}")
|
||||
TEST_COND_CLANG_O2=$(eval echo \
|
||||
"\${MATRIX_${HOST_CPU}_CLANG_O2:-${MATRIX_DEFAULT_CLANG_O2}}")
|
||||
TEST_COND_CLANG_RPM=$(eval echo \
|
||||
"\${MATRIX_${HOST_CPU}_CLANG_RPM:-${MATRIX_DEFAULT_CLANG_RPM}}")
|
||||
|
||||
exit_status=0
|
||||
# A temporary buffer to store the return value from a function.
|
||||
result_buf=
|
||||
|
||||
# Print compiler versions.
|
||||
gcc --version
|
||||
g++ --version
|
||||
clang --version
|
||||
clang++ --version
|
||||
|
||||
echo "== Tests on gcc in a default status =="
|
||||
if ! BUILD_DIR="build/gcc" CC="gcc" CXX="g++" \
|
||||
_run_test_and_get_result "${TEST_COND_GCC_DEFAULT}"; then
|
||||
exit_status=1
|
||||
fi
|
||||
result_gcc="${result_buf}"
|
||||
|
||||
echo "== Tests on clang in a default status =="
|
||||
if ! BUILD_DIR="build/clang" CC="clang" CXX="clang++" \
|
||||
CFLAGS="--rtlib=compiler-rt" CXXFLAGS="--rtlib=compiler-rt" \
|
||||
_run_test_and_get_result "${TEST_COND_CLANG_DEFAULT}"; then
|
||||
exit_status=1
|
||||
fi
|
||||
result_clang="${result_buf}"
|
||||
|
||||
echo "== Tests on gcc with O2 flag =="
|
||||
if ! BUILD_DIR="build/gcc-O2" CC="gcc" CXX="g++" \
|
||||
CFLAGS="-O2" CXXFLAGS="-O2" \
|
||||
_run_test_and_get_result "${TEST_COND_GCC_O2}"; then
|
||||
exit_status=1
|
||||
fi
|
||||
result_gcc_O2="${result_buf}"
|
||||
|
||||
echo "== Tests on clang with O2 flag =="
|
||||
if ! BUILD_DIR="build/clang-O2" CC="clang" CXX="clang++" \
|
||||
CFLAGS="--rtlib=compiler-rt -O2" CXXFLAGS="--rtlib=compiler-rt -O2" \
|
||||
_run_test_and_get_result "${TEST_COND_CLANG_O2}"; then
|
||||
exit_status=1
|
||||
fi
|
||||
result_clang_O2="${result_buf}"
|
||||
|
||||
# This is an advanced test.
|
||||
echo "== Tests on gcc with flags used in RPM package build =="
|
||||
if ! BUILD_DIR="build/gcc-rpm" CC="gcc" CXX="g++" \
|
||||
CFLAGS="${CI_GCC_RPM_CFLAGS-}" CXXFLAGS="${CI_GCC_RPM_CXXFLAGS-}" \
|
||||
LDFLAGS="${CI_GCC_RPM_LDFLAGS-}" \
|
||||
_run_test_and_get_result "${TEST_COND_GCC_RPM}"; then
|
||||
exit_status=1
|
||||
fi
|
||||
result_gcc_rpm="${result_buf}"
|
||||
|
||||
# This is an advanced test.
|
||||
echo "== Tests on clang with flags used in RPM package build =="
|
||||
if ! BUILD_DIR="build/clang-rpm" CC="clang" CXX="clang++" \
|
||||
CFLAGS="${CI_CLANG_RPM_CFLAGS-}" CXXFLAGS="${CI_CLANG_RPM_CXXFLAGS-}" \
|
||||
LDFLAGS="${CI_CLANG_RPM_LDFLAGS-}" \
|
||||
_run_test_and_get_result "${TEST_COND_CLANG_RPM}"; then
|
||||
exit_status=1
|
||||
fi
|
||||
result_clang_rpm="${result_buf}"
|
||||
|
||||
# Print results.
|
||||
cat <<EOF
|
||||
== Results ==
|
||||
Exit status: ${exit_status}
|
||||
${result_gcc}: gcc without flags
|
||||
${result_gcc_O2}: gcc with -O2 flag
|
||||
${result_gcc_rpm}: gcc with RPM build flags
|
||||
${result_clang}: clang without flags
|
||||
${result_clang_O2}: clang with -O2 flag
|
||||
${result_clang_rpm}: clang with RPM build flags
|
||||
EOF
|
||||
|
||||
if [ "${IGNORE_EXIT_STATUS}" = true ]; then
|
||||
echo "warning: Exiting always with exit status zero is not ideal."
|
||||
exit 0
|
||||
else
|
||||
exit ${exit_status}
|
||||
fi
|
||||
Vendored
+81
@@ -0,0 +1,81 @@
|
||||
# Disable the automatically set build flags to the environment variables such
|
||||
# as CC, CFLAGS, and etc.
|
||||
# See <https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/rawhide/f/macros>.
|
||||
%undefine _auto_set_build_flags
|
||||
|
||||
Name: simde
|
||||
Version: 1
|
||||
Release: 1%{?dist}
|
||||
Summary: Dummy
|
||||
License: MIT
|
||||
URL: https://github.com/simd-everywhere/simde
|
||||
# This value is magically replaced with the archive tar.gz file created by
|
||||
# `git archive` in the process of the CI.
|
||||
# Set the existing file `README.md` in case of creating SRPM from this RPM spec
|
||||
# file on local for testing purpose.
|
||||
Source0: README.md
|
||||
# A path to the CI script.
|
||||
Source1: ci.sh
|
||||
|
||||
# List up the needed RPM package names to test here.
|
||||
# clang, clang++
|
||||
BuildRequires: clang
|
||||
BuildRequires: compiler-rt
|
||||
BuildRequires: gcc
|
||||
# g++
|
||||
BuildRequires: gcc-c++
|
||||
# ninja
|
||||
BuildRequires: ninja-build
|
||||
# pip and setuptools are needed to install and use meson PyPI package.
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-pip
|
||||
BuildRequires: python3-setuptools
|
||||
# The GNU time (/bin/time) is used for testing. Use this GNU time rather than
|
||||
# the embedded time function in bash.
|
||||
# https://www.gnu.org/software/time/
|
||||
BuildRequires: time
|
||||
|
||||
# RPM package description.
|
||||
%description
|
||||
|
||||
# The bash commands to prepare are executed.
|
||||
%prep
|
||||
# Print the replaced value of the Source0.
|
||||
echo "Source0: %{SOURCE0}"
|
||||
# Create a dummy file for a valid RPM spec file.
|
||||
touch dummy.txt
|
||||
|
||||
# The bash commands to test are executed.
|
||||
%check
|
||||
# Check the directory structure in the tar.gz file.
|
||||
tar tzvf "%{SOURCE0}" > source_files.txt
|
||||
head -2 source_files.txt
|
||||
# Check if the submodule munit is included.
|
||||
grep munit source_files.txt
|
||||
# Extract the source archive file.
|
||||
tar xzf "%{SOURCE0}"
|
||||
|
||||
pushd simde-*
|
||||
# Set the flags used to build the actual RPM package.
|
||||
# These can be used in the CI testing script.
|
||||
%global toolchain clang
|
||||
export CI_CLANG_RPM_CFLAGS="%{build_cflags}"
|
||||
export CI_CLANG_RPM_CXXFLAGS="%{build_cxxflags}"
|
||||
export CI_CLANG_RPM_LDFLAGS="%{build_ldflags}"
|
||||
%global toolchain gcc
|
||||
export CI_GCC_RPM_CFLAGS="%{build_cflags}"
|
||||
export CI_GCC_RPM_CXXFLAGS="%{build_cxxflags}"
|
||||
export CI_GCC_RPM_LDFLAGS="%{build_ldflags}"
|
||||
|
||||
echo "Running the CI script %{SOURCE1}."
|
||||
/bin/time -f '=> [%E]' "%{SOURCE1}"
|
||||
popd
|
||||
|
||||
# Files included in the built RPM package.
|
||||
%files
|
||||
%doc dummy.txt
|
||||
|
||||
# Changelog entries for the RPM package.
|
||||
%changelog
|
||||
* Fri Jun 02 2023 Dummy Dummy <dummy@dummy.com> - 1-1
|
||||
- Dummy.
|
||||
Reference in New Issue
Block a user