diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..282e16b --- /dev/null +++ b/gating.yaml @@ -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} diff --git a/plans/ci.fmf b/plans/ci.fmf new file mode 100644 index 0000000..1ad2c12 --- /dev/null +++ b/plans/ci.fmf @@ -0,0 +1,6 @@ +summary: CI Gating Plan +discover: + how: fmf + directory: tests +execute: + how: beakerlib diff --git a/tests/README b/tests/README new file mode 100644 index 0000000..85bfa9f --- /dev/null +++ b/tests/README @@ -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. diff --git a/tests/Regression/testsuite2/Makefile b/tests/Regression/testsuite2/Makefile new file mode 100644 index 0000000..eaf64f3 --- /dev/null +++ b/tests/Regression/testsuite2/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/nasm/Regression/testsuite2 +# Description: testsuite2 +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/Regression/testsuite2/PURPOSE b/tests/Regression/testsuite2/PURPOSE new file mode 100644 index 0000000..44ccb86 --- /dev/null +++ b/tests/Regression/testsuite2/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/nasm/Regression/testsuite2 +Description: testsuite2 +Author: Martin Cermak diff --git a/tests/Regression/testsuite2/main.fmf b/tests/Regression/testsuite2/main.fmf new file mode 100644 index 0000000..8d8550d --- /dev/null +++ b/tests/Regression/testsuite2/main.fmf @@ -0,0 +1,19 @@ +summary: testsuite2 +description: '' +contact: Martin Cermak +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 diff --git a/tests/Regression/testsuite2/runtest.sh b/tests/Regression/testsuite2/runtest.sh new file mode 100755 index 0000000..93e84e3 --- /dev/null +++ b/tests/Regression/testsuite2/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/Sanity/smoke/Makefile b/tests/Sanity/smoke/Makefile new file mode 100644 index 0000000..aab49ac --- /dev/null +++ b/tests/Sanity/smoke/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/nasm/Sanity/smoke +# Description: Smoke checks +# Author: Vaclav Kadlcik +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/Sanity/smoke/PURPOSE b/tests/Sanity/smoke/PURPOSE new file mode 100644 index 0000000..66cb72c --- /dev/null +++ b/tests/Sanity/smoke/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/nasm/Sanity/smoke +Description: Smoke checks +Author: Vaclav Kadlcik diff --git a/tests/Sanity/smoke/files/false.asm b/tests/Sanity/smoke/files/false.asm new file mode 100644 index 0000000..adc9852 --- /dev/null +++ b/tests/Sanity/smoke/files/false.asm @@ -0,0 +1,7 @@ + global _start + + section .text +_start: + mov rax, 60 ; sys_exit call + mov rdi, 1 ; value + syscall diff --git a/tests/Sanity/smoke/files/false.bin b/tests/Sanity/smoke/files/false.bin new file mode 100644 index 0000000..15bc832 Binary files /dev/null and b/tests/Sanity/smoke/files/false.bin differ diff --git a/tests/Sanity/smoke/files/true.asm b/tests/Sanity/smoke/files/true.asm new file mode 100644 index 0000000..aab62aa --- /dev/null +++ b/tests/Sanity/smoke/files/true.asm @@ -0,0 +1,7 @@ + global _start + + section .text +_start: + mov rax, 60 ; sys_exit call + mov rdi, 0 ; value + syscall diff --git a/tests/Sanity/smoke/main.fmf b/tests/Sanity/smoke/main.fmf new file mode 100644 index 0000000..3eb306b --- /dev/null +++ b/tests/Sanity/smoke/main.fmf @@ -0,0 +1,13 @@ +summary: Smoke checks +description: '' +contact: Vaclav Kadlcik +component: +- nasm +test: ./runtest.sh +framework: beakerlib +recommend: +- nasm +- binutils +duration: 20m +extra-summary: /tools/nasm/Sanity/smoke +extra-task: /tools/nasm/Sanity/smoke diff --git a/tests/Sanity/smoke/runtest.sh b/tests/Sanity/smoke/runtest.sh new file mode 100755 index 0000000..2c60ae1 --- /dev/null +++ b/tests/Sanity/smoke/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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