Added the Linux Test Project kernel testing tools. (#4386)

This commit is contained in:
Pawel Winogrodzki 2022-12-13 11:56:01 -08:00 коммит произвёл GitHub
Родитель e0f8e7a908
Коммит 538ce96dcf
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 208 добавлений и 1 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -2054,6 +2054,7 @@
"lld",
"local-path-provisioner",
"lsb-release",
"ltp",
"lttng-consume",
"mariner-release",
"mariner-repos",

Просмотреть файл

@ -0,0 +1,100 @@
#!/bin/bash
set -e
SRC_TARBALL=""
OUT_FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PKG_VERSION=""
function arg_present_check {
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
}
# parameters:
#
# --srcTarball : src tarball file
# this file contains the 'initial' source code of the component
# and should be replaced with the new/modified src code
# --outFolder : folder where to copy the new tarball(s)
# --pkgVersion : package version
#
PARAMS=""
while (( "$#" )); do
case "$1" in
--srcTarball)
arg_present_check "$1" "$2"
SRC_TARBALL=$2
shift 2
;;
--outFolder)
arg_present_check "$1" "$2"
OUT_FOLDER=$2
shift 2
;;
--pkgVersion)
arg_present_check "$1" "$2"
PKG_VERSION=$2
shift 2
;;
-*) # unsupported flags
echo "Error: Unsupported flag ($1)" >&2
exit 1
;;
*) # preserve positional arguments
PARAMS="$PARAMS $1"
shift
;;
esac
done
echo "--srcTarball -> $SRC_TARBALL"
echo "--outFolder -> $OUT_FOLDER"
echo "--pkgVersion -> $PKG_VERSION"
if [ -z "$PKG_VERSION" ]; then
echo "--pkgVersion parameter cannot be empty"
exit 1
fi
echo "-- create temp folder"
TEMPDIR=$(mktemp -d)
function cleanup {
echo "+++ cleanup -> remove $TEMPDIR"
rm -rf "$TEMPDIR"
}
trap cleanup EXIT
echo 'Starting LTP submodules source tarball creation.'
git -C "$TEMPDIR" clone --depth 1 git@github.com:linux-test-project/ltp.git -b "$PKG_VERSION"
git -C "$TEMPDIR"/ltp submodule update --init
if [[ -n $SRC_TARBALL ]]; then
TARBALL_NAME="$(basename "$SRC_TARBALL")"
else
TARBALL_NAME="ltp_submodules-$PKG_VERSION.tar.gz"
fi
NEW_TARBALL="$OUT_FOLDER/$TARBALL_NAME"
# Create a reproducible tarball
# Credit to https://reproducible-builds.org/docs/archives/ for instructions
# Do not update mtime value for new versions- keep the same value for ease of
# reproducing old tarball versions in the future if necessary
tar --sort=name --mtime="2021-11-10 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-C "$TEMPDIR"/ltp -zcf "$NEW_TARBALL" testcases/kernel/mce-test tools/sparse/sparse-src
echo "Submodules source tarball ($NEW_TARBALL) successfully created!"
echo "SHA-256: $(sha256sum "$NEW_TARBALL")"

Просмотреть файл

@ -0,0 +1,6 @@
{
"Signatures": {
"ltp-20220930.tar.gz": "b31df2eae6497299907903b47acef314ea8c0e73eb9319b3e881c27e911232ba",
"ltp_submodules-20220930.tar.gz": "48616fc76a18d0a166649fe1f0f3d1457d39e1ba7c2399ae7a03e3a09a8d734d"
}
}

90
SPECS/ltp/ltp.spec Normal file
Просмотреть файл

@ -0,0 +1,90 @@
# Package build hangs during debug info extraction.
%global debug_package %{nil}
%define ltp_prefix /opt/%{name}
# Don't generate requires on Korn shell.
# Mariner doesn't have it, so we can skip/fail its tests.
%global __requires_exclude_from %{ltp_prefix}/testcases/data/file01/in.ksh
Summary: Linux Test Project
Name: ltp
Version: 20220930
Release: 1%{?dist}
License: GPL-2.0-only
Vendor: Microsoft Corporation
Distribution: Mariner
Group: System Environment/Base
URL: https://aka.ms/cbl-mariner
Source0: https://github.com/linux-test-project/ltp/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Use the generate_submodules_tarball.sh script to create a tarball during version updates.
Source1: %{name}_submodules-%{version}.tar.gz
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
BuildRequires: flex
BuildRequires: gcc
BuildRequires: glibc-devel
BuildRequires: kernel-headers
BuildRequires: libacl-devel
BuildRequires: libaio-devel
BuildRequires: libcap-devel
BuildRequires: libmnl-devel
BuildRequires: libnuma-devel
BuildRequires: libtirpc-devel
BuildRequires: m4
BuildRequires: make
BuildRequires: pkg-config
Requires: expect
Requires: glibc
Requires: libacl
Requires: libaio
Requires: libcap
Requires: libmnl
Requires: libnuma
Requires: libtirpc
Requires: psmisc
Requires: tcsh
%description
Linux Test Project is a set of tests to validate the reliability, robustness, and stability of the Linux kernel.
%package doc
Summary: LTP documentation
BuildArch: noarch
%description doc
LTP documentation and manuals.
%prep
%autosetup -a 1
%build
make autotools
%configure \
--bindir=%{ltp_prefix}/bin \
--exec_prefix=%{ltp_prefix} \
--prefix=%{ltp_prefix}
%make_build
%install
%make_install
%check
# Disabling cloning of git submodules - already provided in Source1
sed -i "s/git submodule.*/@echo 'Skipping submodule init - already provided.'/" tools/sparse/Makefile
make check
%files
%license COPYING
%{ltp_prefix}
%files doc
%{_mandir}/*
%changelog
* Wed Nov 30 2022 Pawel Winogrodzki <pawelwi@microsoft.com> - 20220930-1
- Original version for CBL-Mariner.
- License verified.

Просмотреть файл

@ -11276,6 +11276,16 @@
}
}
},
{
"component": {
"type": "other",
"other": {
"name": "ltp",
"version": "20220930",
"downloadUrl": "https://github.com/linux-test-project/ltp/archive/refs/tags/20220930.tar.gz"
}
}
},
{
"component": {
"type": "other",