Enable gating and import some RHEL tests

This commit is contained in:
Václav Kadlčík 2021-09-01 13:49:47 +02:00
parent 965841626a
commit 5ad9e65d12
15 changed files with 331 additions and 0 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

6
plans/ci.fmf Normal file
View File

@ -0,0 +1,6 @@
summary: CI Gating Plan
discover:
how: fmf
directory: tests
execute:
how: beakerlib

3
tests/README Normal file
View File

@ -0,0 +1,3 @@
Tests imported from RHEL keep their Makefile just for backward compatibility
with the traditional beakerlib test harness in RHEL. The Makefiles are _not_
used in the Fedora CI infrastructure.

View File

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/nasm/Regression/testsuite2
# Description: testsuite2
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/nasm/Regression/testsuite2
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: testsuite2" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 48h" >> $(METADATA)
@echo "RunFor: nasm" >> $(METADATA)
@echo "Requires: nasm" >> $(METADATA)
@echo "Requires: perl autoconf asciidoc xmlto gcc make rpm-build" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6 -RHEL7 -RedHatEnterpriseLinuxAlternateArchitectures7" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /tools/nasm/Regression/testsuite2
Description: testsuite2
Author: Martin Cermak <mcermak@redhat.com>

View File

@ -0,0 +1,19 @@
summary: testsuite2
description: ''
contact: Martin Cermak <mcermak@redhat.com>
component:
- nasm
test: ./runtest.sh
framework: beakerlib
recommend:
- nasm
- perl
- autoconf
- asciidoc
- xmlto
- gcc
- make
- rpm-build
duration: 48h
extra-summary: /tools/nasm/Regression/testsuite2
extra-task: /tools/nasm/Regression/testsuite2

View File

@ -0,0 +1,57 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/nasm/Regression/testsuite2
# Description: testsuite2
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="nasm"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TMP=\$(mktemp -p $HOME -d)"
rlRun "pushd $TMP"
rlFetchSrcForInstalled $PACKAGE
rlRun "dnf builddep -y *src.rpm --nobest"
rlRun "rpm --define='_topdir $TMP' -Uvh *src.rpm"
rlRun "rpmbuild --define='_topdir $TMP' -bc SPECS/nasm.spec"
rlPhaseEnd
rlPhaseStartTest
rlRun "pushd BUILD/nasm-*/test"
rlRun "./performtest.pl --golden --nasm=/usr/bin/nasm --verbose $(ls *.asm | fgrep -v _version.asm | tr '\n' ' ')"
rlRun "./performtest.pl --nasm=/usr/bin/nasm --verbose $(ls *.asm | fgrep -v _version.asm | tr '\n' ' ')"
rlRun "popd"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TMP"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/nasm/Sanity/smoke
# Description: Smoke checks
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2021 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/nasm/Sanity/smoke
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE files
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Vaclav Kadlcik <vkadlcik@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Smoke checks" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 20m" >> $(METADATA)
@echo "RunFor: nasm" >> $(METADATA)
@echo "Requires: nasm binutils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6 -RHEL7 -RHEL-ALT-7" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /tools/nasm/Sanity/smoke
Description: Smoke checks
Author: Vaclav Kadlcik <vkadlcik@redhat.com>

View File

@ -0,0 +1,7 @@
global _start
section .text
_start:
mov rax, 60 ; sys_exit call
mov rdi, 1 ; value
syscall

Binary file not shown.

View File

@ -0,0 +1,7 @@
global _start
section .text
_start:
mov rax, 60 ; sys_exit call
mov rdi, 0 ; value
syscall

View File

@ -0,0 +1,13 @@
summary: Smoke checks
description: ''
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- nasm
test: ./runtest.sh
framework: beakerlib
recommend:
- nasm
- binutils
duration: 20m
extra-summary: /tools/nasm/Sanity/smoke
extra-task: /tools/nasm/Sanity/smoke

78
tests/Sanity/smoke/runtest.sh Executable file
View File

@ -0,0 +1,78 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/nasm/Sanity/smoke
# Description: Smoke checks
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2021 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlJournalStart
rlPhaseStartSetup
rlRun "TmpDir=\$(mktemp -d)"
rlRun "cp files/* $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest man
rlRun 'MANPAGER=cat MANWIDTH=16384 man nasm >man_nasm.out'
rlRun 'MANPAGER=cat MANWIDTH=16384 man ndisasm >man_ndisasm.out'
rlAssertGrep 'Netwide Assembler' man_nasm.out
rlAssertGrep 'Netwide Disassembler' man_ndisasm.out
rlPhaseEnd
rlPhaseStartTest nasm
for i in true false; do
# nasm itself
rlRun "nasm -felf64 ${i}.asm"
# nasm is 80x86-specific so the following doesn't make sense
# anywhere else
if [[ $(uname -m) = x86_64 ]]; then
rlRun "ld -o $i $i.o"
if $i; then
rlRun "./$i" 0
else
rlRun "./$i" 1
fi
fi
done
rlPhaseEnd
rlPhaseStartTest ndisasm
# ndisasm is quite limited, we can't use it on anything but 'raw' binary
# code. "false.bin" is just the effective part "manually" cut out from
# "false.o".
rlRun 'ndisasm -b 64 false.bin >disassembled.txt'
rlAssertGrep 'mov eax' disassembled.txt -i
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd