add test
This commit is contained in:
parent
be2ac2a4a8
commit
902f597125
5 changed files with 249 additions and 0 deletions
64
Sanity/smoke-test/Makefile
Normal file
64
Sanity/smoke-test/Makefile
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /CoreOS/tinycdb/Sanity/smoke-test
|
||||
# Description: smoke test
|
||||
# Author: Jaroslav Škarvada <jskarvad@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# 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/tinycdb/Sanity/smoke-test
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE tests.sh
|
||||
|
||||
.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: Jaroslav Škarvada <jskarvad@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: smoke test" >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "RunFor: tinycdb" >> $(METADATA)
|
||||
@echo "Requires: tinycdb diffutils" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: yes" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
||||
3
Sanity/smoke-test/PURPOSE
Normal file
3
Sanity/smoke-test/PURPOSE
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
PURPOSE of /CoreOS/tinycdb/Sanity/smoke-test
|
||||
Description: smoke test
|
||||
Author: Jaroslav Škarvada <jskarvad@redhat.com>
|
||||
28
Sanity/smoke-test/main.fmf
Normal file
28
Sanity/smoke-test/main.fmf
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
summary: smoke test
|
||||
description: ''
|
||||
contact: Petr Sklenar <psklenar@redhat.com>
|
||||
component:
|
||||
- tinycdb
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- tinycdb
|
||||
- diffutils
|
||||
duration: 5m
|
||||
enabled: true
|
||||
tag:
|
||||
- NoRHEL4
|
||||
- NoRHEL5
|
||||
- TIPfail
|
||||
- Tier1
|
||||
- rhel-buildroot
|
||||
- rhel8-buildroot
|
||||
- rhel8-crb
|
||||
tier: '1'
|
||||
adjust:
|
||||
- enabled: false
|
||||
when: distro == rhel-4, rhel-5, rhel-6, rhel-7
|
||||
continue: false
|
||||
extra-nitrate: TC#0598800
|
||||
extra-summary: /CoreOS/tinycdb/Sanity/smoke-test
|
||||
extra-task: /CoreOS/tinycdb/Sanity/smoke-test
|
||||
51
Sanity/smoke-test/runtest.sh
Executable file
51
Sanity/smoke-test/runtest.sh
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/tinycdb/Sanity/smoke-test
|
||||
# Description: smoke test
|
||||
# Author: Jaroslav Škarvada <jskarvad@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="tinycdb"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "cp ./tests.sh $TmpDir/" 0 "Copying test suite"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "./tests.sh" 0 "Running modified upstream test suite"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
103
Sanity/smoke-test/tests.sh
Executable file
103
Sanity/smoke-test/tests.sh
Executable file
|
|
@ -0,0 +1,103 @@
|
|||
#! /bin/sh
|
||||
|
||||
# tests.sh: This script will run tests for cdb.
|
||||
# Execute with ./tests.sh ./cdb
|
||||
# (first arg if present gives path to cdb tool to use, default is `cdb').
|
||||
#
|
||||
# This file is a part of tinycdb package by Michael Tokarev, mjt@corpit.ru.
|
||||
# Public domain.
|
||||
# Slightly modified for automated testing by Jaroslav Škarvada <jskarvad@redhat.com>
|
||||
|
||||
case "$1" in
|
||||
"") cdb=cdb ;;
|
||||
*) cdb="$1" ;;
|
||||
esac
|
||||
|
||||
rm -f 1.cdb 1a.cdb
|
||||
|
||||
echo Create simple db
|
||||
echo "+3,4:one->here
|
||||
+1,1:a->b
|
||||
+1,3:b->abc
|
||||
+3,4:one->also
|
||||
|
||||
" | $cdb -c 1.cdb || exit 1
|
||||
|
||||
echo Dump simple db
|
||||
$cdb -d 1.cdb || exit 2
|
||||
|
||||
echo Stats for simple db
|
||||
$cdb -s 1.cdb || exit 3
|
||||
|
||||
echo "Query simple db (two records match)"
|
||||
$cdb -q 1.cdb one || exit 4
|
||||
echo
|
||||
|
||||
echo Query for non-existed key
|
||||
$cdb -q 1.cdb none && exit 5
|
||||
|
||||
echo Doing 600 repeated records
|
||||
(
|
||||
for i in 0 1 2 3 4 5 ; do
|
||||
for j in 0 1 2 3 4 5 6 7 8 9 ; do
|
||||
for k in 0 1 2 3 4 5 6 7 8 9 ; do
|
||||
echo "+1,3:a->$i$j$k"
|
||||
done
|
||||
done
|
||||
done
|
||||
echo "+1,5:b->other"
|
||||
echo
|
||||
) | $cdb -c 1.cdb || exit 6
|
||||
|
||||
|
||||
echo cdb stats should show 601 record
|
||||
$cdb -s 1.cdb || exit 7
|
||||
|
||||
echo Querying key
|
||||
$cdb -q 1.cdb b || exit 8
|
||||
echo
|
||||
|
||||
echo Dumping and re-creating db
|
||||
$cdb -d 1.cdb | $cdb -c 1a.cdb || exit 9
|
||||
cmp 1.cdb 1a.cdb || exit 10
|
||||
|
||||
$cdb -d -m 1.cdb | $cdb -c -m 1a.cdb || exit 11
|
||||
cmp 1.cdb 1a.cdb || exit 12
|
||||
|
||||
echo Handling large key size
|
||||
echo "+123456789012,1:" | $cdb -c 1.cdb && exit 13
|
||||
|
||||
echo Handling large value size
|
||||
echo "+1,123456789012:" | $cdb -c 1.cdb && exit 14
|
||||
|
||||
echo "Handling invalid input format (short file)"
|
||||
echo "+10,10:" | $cdb -c 1.cdb && exit 15
|
||||
|
||||
echo Creating db with eol in key and value
|
||||
echo "+2,2:a
|
||||
->b
|
||||
|
||||
" | $cdb -c 1.cdb || exit 16
|
||||
|
||||
echo Querying key-value with eol
|
||||
$cdb -q 1.cdb "a
|
||||
" || exit 17
|
||||
|
||||
echo Handling file size limits
|
||||
(
|
||||
ulimit -f 4
|
||||
trap '' 25
|
||||
(
|
||||
for i in 0 1 2 3 4 5 6 7 8 9 ; do
|
||||
for j in 0 1 2 3 4 5 6 7 8 9 ; do
|
||||
for k in 0 1 2 3 4 5 6 7 8 9 ; do
|
||||
echo "+4,4:k$i$j$k->v$i$j$k"
|
||||
done
|
||||
done
|
||||
done
|
||||
echo
|
||||
) | $cdb -c 1.cdb || exit 18
|
||||
)
|
||||
|
||||
rm -rf 1.cdb 1a.cdb 1.cdb.tmp
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue