Initial commit for Atomic Host Tests
This commit is contained in:
parent
2d00e2bb9a
commit
bb681e6c30
63
tests/readlink-cannot-handle-recursive-symlinks/Makefile
Normal file
63
tests/readlink-cannot-handle-recursive-symlinks/Makefile
Normal file
@ -0,0 +1,63 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /CoreOS/coreutils/readlink-cannot-handle-recursive-symlink s
|
||||
# Description: Test for readlink cannot handle recursive symlinks
|
||||
# Author: Jan Scotka <jscotka@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2010 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/coreutils/readlink-cannot-handle-recursive-symlinks
|
||||
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)
|
||||
chmod a+x runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Jan Scotka <jscotka@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Test for readlink cannot handle recursive symlinks" >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "RunFor: coreutils" >> $(METADATA)
|
||||
@echo "Requires: coreutils" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
54
tests/readlink-cannot-handle-recursive-symlinks/PURPOSE
Normal file
54
tests/readlink-cannot-handle-recursive-symlinks/PURPOSE
Normal file
@ -0,0 +1,54 @@
|
||||
PURPOSE of /CoreOS/coreutils/readlink-cannot-handle-recursive-symlinks
|
||||
Description: Test for readlink cannot handle recursive symlinks
|
||||
Author: Jan Scotka <jscotka@redhat.com>
|
||||
Bug summary: readlink cannot handle recursive symlinks
|
||||
|
||||
Description:
|
||||
|
||||
Description of problem:
|
||||
The readlink command fails with an error "Too many levels of symbolic links", even if there are only 2 levels.
|
||||
|
||||
The readlink command from RHEL 3 and RHEL 4 and from Fedora 11 all work fine.
|
||||
|
||||
Among other changes between RHEL 4 and RHEL 5, RHEL 5's coreutils added calls to cycle_check() in lib/canonicalize.c, but in upstream canonicalize.c (now in gnulib instead of coreutils), we see the comment:
|
||||
/* Detect loops. We cannot use the cycle-check module here,
|
||||
since it's actually possible to encounter the same symlink
|
||||
more than once in a given traversal. However, encountering
|
||||
the same symlink,NAME pair twice does indicate a loop. */
|
||||
|
||||
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/canonicalize.c;h=4f348398fd69ae516396313d18ac294a4ca3dde3;hb=b653eda3ac4864de205419d9f41eec267cb89eeb#l262
|
||||
|
||||
The latest canonicalize.c uses seen_triple() instead of cycle_check().
|
||||
|
||||
|
||||
Version-Release number of selected component (if applicable):
|
||||
coreutils-5.97-19.el5
|
||||
|
||||
How reproducible:
|
||||
every time
|
||||
|
||||
Steps to Reproduce:
|
||||
1. Create a directory with a symlink to itself
|
||||
mkdir /tmp/dir
|
||||
cd /tmp/dir
|
||||
ln -s ../dir dirlink
|
||||
|
||||
2. Run readlink using the 'dirlink' symlink recursively
|
||||
readlink -v -f dirlink
|
||||
readlink -v -f dirlink/dirlink
|
||||
readlink -v -f dirlink/dirlink/dirlink
|
||||
|
||||
Actual results:
|
||||
The first readlink command on just dirlink succeeds, but the 2nd and 3rd commands fail with
|
||||
readlink: dirlink/dirlink: Too many levels of symbolic links
|
||||
|
||||
Expected results:
|
||||
$ readlink -v -f dirlink
|
||||
/tmp/dir
|
||||
$ readlink -v -f dirlink/dirlink
|
||||
/tmp/dir
|
||||
$ readlink -v -f dirlink/dirlink/dirlink
|
||||
/tmp/dir
|
||||
|
||||
|
||||
Additional info:
|
60
tests/readlink-cannot-handle-recursive-symlinks/runtest.sh
Executable file
60
tests/readlink-cannot-handle-recursive-symlinks/runtest.sh
Executable file
@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/coreutils/readlink-cannot-handle-recursive-symlinks
|
||||
# Description: Test for readlink cannot handle recursive symlinks
|
||||
# Author: Jan Scotka <jscotka@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2010 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include rhts environment
|
||||
. /usr/bin/rhts-environment.sh
|
||||
. /usr/lib/beakerlib/beakerlib.sh
|
||||
|
||||
PACKAGE="coreutils"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlRun "mkdir link" 0 "Creating test directory"
|
||||
rlRun "cd link" 0 "cd to this dir"
|
||||
rlRun "ln -s ../link link" 0 "creating symlink to ../link -> link"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlLog "Test of readlink up to 20 iteration"
|
||||
export TMPVAR="link"
|
||||
for foo in `seq 20`
|
||||
do echo $TMPVAR
|
||||
rlRun "readlink -v -f $TMPVAR" 0 "readlink of $TMPVAR"
|
||||
TMPVAR="$TMPVAR/link"
|
||||
done
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
39
tests/test-basics
Executable file
39
tests/test-basics
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Checks that touch ls rm and foo work
|
||||
# https://www.mankier.com/1/beakerlib#Examples
|
||||
. /usr/share/beakerlib/beakerlib.sh
|
||||
|
||||
# Set the full test name
|
||||
TEST="/examples/beakerlib/Sanity/phases"
|
||||
|
||||
# Package being tested
|
||||
PACKAGE="coreutils"
|
||||
|
||||
rlJournalStart
|
||||
# Setup phase: Prepare test directory
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlRun 'TmpDir=$(mktemp -d)' 0 'Creating tmp directory' # no-reboot
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
# Test phase: Testing touch, ls and rm commands
|
||||
rlPhaseStartTest
|
||||
rlRun "touch foo" 0 "Creating the foo test file"
|
||||
rlAssertExists "foo"
|
||||
rlRun "ls -l foo" 0 "Listing the foo test file"
|
||||
rlRun "rm foo" 0 "Removing the foo test file"
|
||||
rlAssertNotExists "foo"
|
||||
rlRun "ls -l foo" 2 "Listing foo should now report an error"
|
||||
rlPhaseEnd
|
||||
|
||||
# Cleanup phase: Remove test directory
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalEnd
|
||||
|
||||
# Print the test report
|
||||
rlJournalPrintText
|
9
tests/test_basics.yml
Normal file
9
tests/test_basics.yml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
# This first play always runs on the local staging system
|
||||
- hosts: localhost
|
||||
tags:
|
||||
- atomic
|
||||
- classic
|
||||
- container
|
||||
roles:
|
||||
- { role: standard-test-beakerlib, tests: [ test-basics, readlink-cannot-handle-recursive-symlinks ] }
|
1
tests/tests.yml
Normal file
1
tests/tests.yml
Normal file
@ -0,0 +1 @@
|
||||
- include: test_basics.yml
|
Loading…
Reference in New Issue
Block a user