From 9d99481e769a33600565d78ab36a6faf9227e91a Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Jan 23 2020 14:24:57 +0000 Subject: Added gating tests --- diff --git a/ctags.spec b/ctags.spec index a951622..c22822c 100644 --- a/ctags.spec +++ b/ctags.spec @@ -1,7 +1,7 @@ Summary: A C programming language indexing and/or cross-reference tool Name: ctags Version: 5.8 -Release: 26%{?dist} +Release: 27%{?dist} License: GPLv2+ and LGPLv2+ and Public Domain URL: http://ctags.sourceforge.net/ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz @@ -91,6 +91,9 @@ popd %{_mandir}/man1/etags.%{name}.1* %changelog +* Thu Jan 23 2020 Than Ngo - 5.8-27 +- Added gating tests + * Wed Jul 24 2019 Fedora Release Engineering - 5.8-26 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/tests/Sanity-test-for-ctags/Makefile b/tests/Sanity-test-for-ctags/Makefile new file mode 100644 index 0000000..982951b --- /dev/null +++ b/tests/Sanity-test-for-ctags/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/ctags/Sanity-test-for-ctags +# Description: Sanity test +# Author: Than Ngo +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019,2020 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/ctags/Sanity-test-for-ctags +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE ctags-kinds-list ctags-maps-list ctags-lang-list test.python test.c + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Than Ngo " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Sanity test" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 3m" >> $(METADATA) + @echo "RunFor: ctags" >> $(METADATA) + @echo "Requires: coreutils man-db" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+ and LGPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Sanity-test-for-ctags/PURPOSE b/tests/Sanity-test-for-ctags/PURPOSE new file mode 100644 index 0000000..23a869e --- /dev/null +++ b/tests/Sanity-test-for-ctags/PURPOSE @@ -0,0 +1,7 @@ +PURPOSE of /CoreOS/ctags/Sanity-test-for-ctags +Description: smoke test, funktion test for CI gating +Author: Than Ngo + +tests following scenarios: + * smoke test + * funktion test diff --git a/tests/Sanity-test-for-ctags/ctags-kinds-list b/tests/Sanity-test-for-ctags/ctags-kinds-list new file mode 100644 index 0000000..2f1cf3b --- /dev/null +++ b/tests/Sanity-test-for-ctags/ctags-kinds-list @@ -0,0 +1,282 @@ +Ant + p projects + t targets +Asm + d defines + l labels + m macros + t types (structs and records) +Asp + d constants + c classes + f functions + s subroutines + v variables +Awk + f functions +Basic + c constants + f functions + l labels + t types + v variables + g enumerations +BETA + f fragment definitions + p all patterns [off] + s slots (fragment uses) + v patterns (virtual or rebound) +C + c classes + d macro definitions + e enumerators (values inside an enumeration) + f function definitions + g enumeration names + l local variables [off] + m class, struct, and union members + n namespaces + p function prototypes [off] + s structure names + t typedefs + u union names + v variable definitions + x external and forward variable declarations [off] +C++ + c classes + d macro definitions + e enumerators (values inside an enumeration) + f function definitions + g enumeration names + l local variables [off] + m class, struct, and union members + n namespaces + p function prototypes [off] + s structure names + t typedefs + u union names + v variable definitions + x external and forward variable declarations [off] +C# + c classes + d macro definitions + e enumerators (values inside an enumeration) + E events + f fields + g enumeration names + i interfaces + l local variables [off] + m methods + n namespaces + p properties + s structure names + t typedefs +Cobol + d data items + f file descriptions (FD, SD, RD) + g group items + p paragraphs + P program ids + s sections +CSS + c classes + s selectors + i identities +DosBatch + l labels + v variables +Eiffel + c classes + f features + l local entities [off] +Erlang + d macro definitions + f functions + m modules + r record definitions +Flex + f functions + c classes + m methods + p properties + v global variables + x mxtags +Fortran + b block data + c common blocks + e entry points + f functions + i interface contents, generic names, and operators [off] + k type and structure components + l labels + L local, common block, and namelist variables [off] + m modules + n namelists + p programs + s subroutines + t derived types and structures + v program (global) and module variables +HTML + a named anchors + f JavaScript functions +Java + c classes + e enum constants + f fields + g enum types + i interfaces + l local variables [off] + m methods + p packages +JavaScript + f functions + c classes + m methods + p properties + v global variables +Lisp + f functions +Lua + f functions +Make + m macros +MatLab + f function + f function + f function +OCaml + c classes + m Object's method + M Module or functor + v Global variable + t Type name + f A function + C A constructor + r A 'structure' field + e An exception +Pascal + f functions + p procedures +Perl + c constants + f formats + l labels + p packages + s subroutines + d subroutine declarations [off] +PHP + c classes + i interfaces + d constant definitions + f functions + v variables + v variables + j javascript functions + j javascript functions + j javascript functions +Python + c classes + f functions + m class members + v variables + i imports +REXX + s subroutines +Ruby + c classes + f methods + m modules + F singleton methods +Scheme + f functions + s sets +Sh + f functions +SLang + f functions + n namespaces +SML + e exception declarations + f function definitions + c functor definitions + s signature declarations + r structure declarations + t type definitions + v value bindings +SQL + c cursors + d prototypes [off] + f functions + F record fields + l local variables [off] + L block label + P packages + p procedures + r records [off] + s subtypes + t tables + T triggers + v variables + i indexes + e events + U publications + R services + D domains + V views + n synonyms + x MobiLink Table Scripts + y MobiLink Conn Scripts +Tcl + c classes + m methods + p procedures +Tex + c chapters + s sections + u subsections + b subsubsections + p parts + P paragraphs + G subparagraphs +Vera + c classes + d macro definitions + e enumerators (values inside an enumeration) + f function definitions + g enumeration names + l local variables [off] + m class, struct, and union members + p programs + P function prototypes [off] + t tasks + T typedefs + v variable definitions + x external variable declarations [off] +Verilog + c constants (define, parameter, specparam) + e events + f functions + m modules + n net data types + p ports + r register data types + t tasks +VHDL + c constant declarations + t type definitions + T subtype definitions + r record names + e entity declarations + C component declarations [off] + d prototypes [off] + f function prototypes and declarations + p procedure prototypes and declarations + P package definitions + l local definitions [off] +Vim + a autocommand groups + c user-defined commands + f function definitions + m maps + v variable definitions +YACC + l labels diff --git a/tests/Sanity-test-for-ctags/ctags-lang-list b/tests/Sanity-test-for-ctags/ctags-lang-list new file mode 100644 index 0000000..f9338de --- /dev/null +++ b/tests/Sanity-test-for-ctags/ctags-lang-list @@ -0,0 +1,42 @@ +Ant +Asm +Asp +Awk +Basic +BETA +C +C++ +C# +Cobol +CSS +DosBatch +Eiffel +Erlang +Flex +Fortran +HTML +Java +JavaScript +Lisp +Lua +Make +MatLab +OCaml +Pascal +Perl +PHP +Python +REXX +Ruby +Scheme +Sh +SLang +SML +SQL +Tcl +Tex +Vera +Verilog +VHDL +Vim +YACC diff --git a/tests/Sanity-test-for-ctags/ctags-maps-list b/tests/Sanity-test-for-ctags/ctags-maps-list new file mode 100644 index 0000000..d9fe867 --- /dev/null +++ b/tests/Sanity-test-for-ctags/ctags-maps-list @@ -0,0 +1,42 @@ +Ant *.build.xml +Asm *.asm *.ASM *.s *.S *.A51 *.29[kK] *.[68][68][kKsSxX] *.[xX][68][68] +Asp *.asp *.asa +Awk *.awk *.gawk *.mawk +Basic *.bas *.bi *.bb *.pb +BETA *.bet +C *.c +C++ *.c++ *.cc *.cp *.cpp *.cxx *.h *.h++ *.hh *.hp *.hpp *.hxx *.C *.H +C# *.cs +Cobol *.cbl *.cob *.CBL *.COB +CSS *.css +DosBatch *.bat *.cmd +Eiffel *.e +Erlang *.erl *.ERL *.hrl *.HRL +Flex *.as *.mxml +Fortran *.f *.for *.ftn *.f77 *.f90 *.f95 *.F *.FOR *.FTN *.F77 *.F90 *.F95 +HTML *.htm *.html +Java *.java +JavaScript *.js +Lisp *.cl *.clisp *.el *.l *.lisp *.lsp +Lua *.lua +Make *.mak *.mk [Mm]akefile GNUmakefile +MatLab *.m +OCaml *.ml *.mli +Pascal *.p *.pas +Perl *.pl *.pm *.plx *.perl +PHP *.php *.php3 *.phtml +Python *.py *.pyx *.pxd *.pxi *.scons +REXX *.cmd *.rexx *.rx +Ruby *.rb *.ruby +Scheme *.SCM *.SM *.sch *.scheme *.scm *.sm +Sh *.sh *.SH *.bsh *.bash *.ksh *.zsh +SLang *.sl +SML *.sml *.sig +SQL *.sql +Tcl *.tcl *.tk *.wish *.itcl +Tex *.tex +Vera *.vr *.vri *.vrh +Verilog *.v +VHDL *.vhdl *.vhd +Vim *.vim +YACC *.y diff --git a/tests/Sanity-test-for-ctags/runtest.sh b/tests/Sanity-test-for-ctags/runtest.sh new file mode 100755 index 0000000..d952395 --- /dev/null +++ b/tests/Sanity-test-for-ctags/runtest.sh @@ -0,0 +1,51 @@ +#! /bin/sh +# ctags basics + +PACKAGES="ctags" +# SERVICES="" + +# source the test script helpers +# requires beakerlib package +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + for p in $PACKAGES ; do + rlAssertRpm $p + done + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "cp * $TmpDir" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest "Smoke, sanity and function tests" + rlRun "ctags --version" 0 "Show version" + rlRun "ctags --help" 0 "Show help" + rlRun "ctags --license" 0 "Show license" + rlRun -s "ctags --list-kinds" 0 "Output a list of all tag kinds for all languages" + rlAssertNotDiffer ctags-kinds-list $rlRun_LOG + rlRun -s "ctags --list-languages" 0 "Output list of supported languages" + rlAssertNotDiffer ctags-lang-list $rlRun_LOG + rlRun -s "ctags --list-maps" 0 "Output list of language mappings" + rlAssertNotDiffer ctags-maps-list $rlRun_LOG + for l in python c ; do + rlRun "ctags -f test test.$l" 0 "Language: $l, $lWrite tags to file test" + rlAssertExists test + rlRun "ctags --fields=k test.%l" 0 "Language: $l, Include selected extension fields=k" + rlRun "ctags --fields=+afmikKlnsSz test.$l" 0 "Language: $l, Check extension fields=+afmikKlnsSz" + rlRun "ctags --extra=+fq --format=1 test.$l" 0 "Language: $l, Check options --extra=+fq --format=1" + done + # check man page + rlRun "man -P head ctags" 0 "Show the ctags man page" + # check for sane license and readme file + rlRun "head /usr/share/licenses/ctags/COPYING" 0 "Check for license file" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -fr $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd + +rlJournalPrintText +rlJournalEnd diff --git a/tests/Sanity-test-for-ctags/test.c b/tests/Sanity-test-for-ctags/test.c new file mode 100644 index 0000000..7cfe76d --- /dev/null +++ b/tests/Sanity-test-for-ctags/test.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello World\n"); + return 0; +} diff --git a/tests/Sanity-test-for-ctags/test.python b/tests/Sanity-test-for-ctags/test.python new file mode 100644 index 0000000..0d73c24 --- /dev/null +++ b/tests/Sanity-test-for-ctags/test.python @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +def main(): + + return 0 + +if __name__ == '__main__': main() + +var = 'hi' +var2 = 'hi' # blah = blah diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..6ec7675 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,12 @@ +--- +# Run tests in all contexts +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-beakerlib + tests: + - Sanity-test-for-ctags + required_packages: + - ctags + - man-db