From: Panu Matilainen Date: Wed, 8 Feb 2012 15:45:34 +0000 (+0200) Subject: Add a rough-cut testcase for hardlink handling X-Git-Tag: tznext/4.11.0.1.tizen20130304~662 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd5771bbd6d1153288cc127688cf4b99bc3226a2;p=tools%2Flibrpm-tizen.git Add a rough-cut testcase for hardlink handling - Check that we get expected number of links in package generation, that all the files got installed and that the linked files are actually hardlinks (for our purposes, plain inode suffices) --- diff --git a/tests/Makefile.am b/tests/Makefile.am index b919fd3..72b17ca 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -38,6 +38,7 @@ EXTRA_DIST += data/SPECS/versiontest.spec EXTRA_DIST += data/SPECS/conflicttest.spec EXTRA_DIST += data/SPECS/configtest.spec EXTRA_DIST += data/SPECS/flangtest.spec +EXTRA_DIST += data/SPECS/hlinktest.spec EXTRA_DIST += data/SPECS/symlinktest.spec EXTRA_DIST += data/SPECS/deptest.spec EXTRA_DIST += data/SPECS/verifyscript.spec diff --git a/tests/data/SPECS/hlinktest.spec b/tests/data/SPECS/hlinktest.spec new file mode 100644 index 0000000..7c22d29 --- /dev/null +++ b/tests/data/SPECS/hlinktest.spec @@ -0,0 +1,27 @@ +Summary: Testing hard link behavior +Name: hlinktest +Version: 1.0 +Release: 1 +License: Testing +Group: Testing +BuildArch: noarch +%description + +%install +rm -rf %{buildroot} +mkdir -p $RPM_BUILD_ROOT/foo +cat << EOF >> $RPM_BUILD_ROOT/foo/hello +#!/bin/sh +echo $0 +EOF + +cd $RPM_BUILD_ROOT/foo +cat hello > copyllo +chmod a+x hello copyllo +for f in foo bar world; do + ln hello hello-${f} +done + +%files +%defattr(-,root,root) +/foo/* diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at index 136fe46..517de72 100644 --- a/tests/rpmbuild.at +++ b/tests/rpmbuild.at @@ -122,3 +122,33 @@ drwxrwxrwx zoot zoot /j/dir ], []) AT_CLEANUP + +# ------------------------------ +# hardlink tests +AT_SETUP([rpmbuild hardlink]) +AT_KEYWORDS([build]) +AT_CHECK([ +RPMDB_CLEAR +RPMDB_INIT +rm -rf ${TOPDIR} + +runroot rpmbuild \ + -bb --quiet /data/SPECS/hlinktest.spec + +runroot rpm -i "${TOPDIR}"/RPMS/noarch/hlinktest-1.0-1.noarch.rpm + +runroot rpm -q --qf "[[%{filenlinks} %{filenames}\n]]" hlinktest +runroot rpm -V --nouser --nogroup hlinktest +ls -i "${RPMTEST}"/foo/hello* | awk {'print $1'} | sort -u | wc -l + +], +[0], +[1 /foo/copyllo +4 /foo/hello +4 /foo/hello-bar +4 /foo/hello-foo +4 /foo/hello-world +1 +], +[]) +AT_CLEANUP