Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 158375 Details for
Bug 245639
RFE: move check-buildroot, check-rpaths to rpm-build or redhat-rpm-config
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Move check-* to /usr/lib/rpm, add test suite
r-r-c-check.patch (text/plain), 6.59 KB, created by
Ville Skyttä
on 2007-07-02 20:18:03 UTC
(
hide
)
Description:
Move check-* to /usr/lib/rpm, add test suite
Filename:
MIME Type:
Creator:
Ville Skyttä
Created:
2007-07-02 20:18:03 UTC
Size:
6.59 KB
patch
obsolete
>diff --git a/Makefile b/Makefile >index 4325bb2..a7c2d51 100644 >--- a/Makefile >+++ b/Makefile >@@ -13,9 +13,13 @@ clean: > install: > mkdir -p $(DESTDIR)/usr/lib/rpm/redhat > cp -pr * $(DESTDIR)/usr/lib/rpm/redhat/ >+ mv $(DESTDIR)/usr/lib/rpm/redhat/check-* $(DESTDIR)/usr/lib/rpm/ > rm -f $(DESTDIR)/usr/lib/rpm/redhat/Makefile > rm -f $(DESTDIR)/usr/lib/rpm/redhat/redhat-rpm-config.spec > >+check: >+ env srcdir=$(shell pwd) test/rpathtest.sh >+ > tag-archive: > git-tag -a $(CVSTAG) > >diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec >index 27a2874..1031bcb 100644 >--- a/redhat-rpm-config.spec >+++ b/redhat-rpm-config.spec >@@ -22,11 +22,15 @@ Red Hat specific rpm configuration files. > %install > make DESTDIR=${RPM_BUILD_ROOT} install > >+%check >+make check >+ > %clean > rm -rf ${RPM_BUILD_ROOT} > > %files > %defattr(-,root,root) >+%{_prefix}/lib/rpm/check-* > %{_prefix}/lib/rpm/redhat > > %changelog >diff --git a/test/rpathtest.sh b/test/rpathtest.sh >new file mode 100755 >index 0000000..cc919e2 >--- /dev/null >+++ b/test/rpathtest.sh >@@ -0,0 +1,217 @@ >+#! /bin/bash >+ >+: ${CC:=gcc} >+: ${CFLAGS:=-O2 -g3} >+: ${srcdir:=.} >+ >+COL_BOLD= >+COL_NORMAL= >+COL_PANIC= >+COL_OK= >+COL_FAIL= >+COL_TEST= >+COL_NONE= >+MOVE_TO_COL=$(echo -en "\t") >+ >+ >+indent="" >+count_total=0 >+count_ok=0 >+count_fail=0 >+ >+# Usage: panic <msg> >+function panic() { >+ echo "$COL_PANIC""$@""$COL_NONE" >&2 >+ exit 1 >+} >+ >+function tellOk() { >+ echo "$MOVE_TO_COL${COL_OK}OK$COL_NONE" >+ let ++count_ok >+} >+ >+function tellFail() { >+ echo "$MOVE_TO_COL${COL_FAIL}FAIL$COL_NONE" >+ let ++count_fail >+} >+ >+function tellTest() { >+ echo -n "$indent$COL_TEST""$@""$COL_NONE" >+ let ++count_total >+} >+ >+function tellTestGroup() >+{ >+ echo "$indent$COL_TEST""$@""$COL_NONE" >+ indent="$indent " >+} >+ >+function tellTestGroupEnd() >+{ >+ indent=${indent:2} >+} >+ >+function tellResult() >+{ >+ echo "${COL_BOLD}Result:$COL_NORMAL $COL_TEST$count_total$COL_NONE tests total, $COL_FAIL$count_fail$COL_NONE failed, $COL_OK$count_ok$COL_NONE succeeded" >+ test $count_fail -eq 0 >+} >+ >+function initcolors() { >+ ! tty -s || { >+ COL_PANIC=$(echo -en "\e[1;33;41m") >+ COL_OK=$(echo -en "\e[0;32m") >+ COL_FAIL=$(echo -en "\e[0;31m") >+ COL_TEST=$(echo -en "\e[0;34m") >+ COL_NONE=$(echo -en "\e[m") >+ COL_BOLD=$(echo -en "\e[1m") >+ COL_NORMAL=$(echo -en "\e[1m") >+ MOVE_TO_COL=$(echo -en "\e[60G\t") >+ } >+} >+ >+tmpdir=$(mktemp -d /tmp/rpath-test.XXXXXX) >+mkdir -p $tmpdir >+trap "rm -rf $tmpdir" EXIT >+ >+ >+initcolors >+ >+set -e >+ >+## create the test objects >+tellTest "Creating sourcefiles" >+ >+cat >$tmpdir/libok.c <<"EOF" >+#include <unistd.h> >+int foo() { write(1, "OK\n", 3); return 0; } >+EOF >+ >+cat >$tmpdir/libfail.c <<"EOF" >+#include <unistd.h> >+int foo() { write(1, "FAIL\n", 5); return 1; } >+EOF >+ >+ >+cat >$tmpdir/test.c <<"EOF" >+extern int foo(); >+int main() { return foo(); } >+EOF >+ >+tellOk >+ >+## create the libraries >+tellTest "Creating the libraries" >+ >+mkdir -p $tmpdir/lib{ok,fail} >+$CC $CFLAGS -fpic -shared $tmpdir/libok.c -o $tmpdir/libok/librpathtest.so >+$CC $CFLAGS -fpic -shared $tmpdir/libfail.c -o $tmpdir/libfail/librpathtest.so >+ >+tellOk >+ >+## and some scenarios >+tellTest "Creating some scenarios" >+mkdir $tmpdir/scenarios >+( >+ cd $tmpdir/scenarios >+ mkdir -p 1/usr/{dir1,dir2/{lib,dir1}} >+ ln -s dir2/lib/ 1/usr/lib >+ >+ ln ../libok/*.so 1/usr/dir1/ >+ ln ../libfail/*.so 1/usr/dir2/dir1/ >+ >+### this creates: >+# . >+# |-- dir1 >+# | `-- librpathtest.so [ok] >+# |-- dir2 >+# | |-- dir1 >+# | | `-- librpathtest.so [fail] >+# | `-- lib >+# `-- lib -> dir2/lib/ >+) >+ >+tellOk >+ >+ >+## and the programs >+function compile() { >+ local name=$1 >+ shift >+ tellTest "compiling $name" >+ $CC $CFLAGS $tmpdir/test.c -o $tmpdir/$name "$@" -L $tmpdir/libok -lrpathtest && tellOk || tellFail >+} >+ >+mkdir -p $tmpdir/{ok,fail} >+ >+tellTestGroup "Compiling the good programs" >+ compile ok/link-0 >+ compile ok/link-1 -Wl,-rpath='/usr/lib/foo' >+ compile ok/link-2 -Wl,-rpath='/usr/lib/foo' -Wl,-rpath='/usr/lib/bar' >+ compile ok/link-3 -Wl,-rpath='$ORIGIN' >+ compile ok/link-4 -Wl,-rpath='$ORIGIN/..' >+ compile ok/link-5 -Wl,-rpath='$ORIGIN/../text' >+ compile ok/link-6 -Wl,-rpath='$ORIGIN/../..' >+ compile ok/link-7 -Wl,-rpath='$ORIGIN/../../test' >+ compile ok/exec-0 -Wl,-rpath='$ORIGIN/../libok' >+ compile ok/exec-1 -Wl,-rpath='$ORIGIN/../scenarios/1/usr/dir1' >+tellTestGroupEnd >+ >+tellTest "Checking the good programs" >+ export RPM_BUILD_ROOT=$tmpdir >+ bash $srcdir/check-rpaths-worker $tmpdir/ok/* && tellOk || tellFail >+ >+tellTestGroup "Compiling the bad programs" >+ compile fail/link-0 -Wl,-rpath='/usr/lib' >+ compile fail/link-1 -Wl,-rpath='.' >+ compile fail/link-2 -Wl,-rpath='' >+ compile fail/link-3 -Wl,-rpath='$ORIGIN/test/../libok' >+ compile fail/exec-0 -Wl,-rpath='$ORIGIN/../scenarios/1/usr/lib/../dir1' >+tellTestGroupEnd >+ >+tellTestGroup "Checking the bad programs" >+ export RPM_BUILD_ROOT=$tmpdir >+ bash $srcdir/check-rpaths-worker $tmpdir/fail/* 2>$tmpdir/err >/dev/null || : >+ >+# check whether all errors were detected >+for i in '0001 link-0' '0004 link-1' '0010 link-2' '0020 link-3' '0020 exec-0'; do >+ set -- $i >+ tellTest "checking for error $1 in $2" >+ grep -q "^ERROR *$1:.*'/fail/$2'" $tmpdir/err && tellOk || tellFail >+done >+tellTestGroupEnd >+ >+## check some paths manually for referencing '..' >+tellTestGroup "Checking some paths for error 0x0020" >+ set -- >+ . $srcdir/check-rpaths-worker >+ >+ tellTestGroup "Checking good paths" >+ # good paths >+ for i in '/' '/..' '/test' '/test/foo' '/test/...' '/test/.../foo' \ >+ 'foo/bar/...' \ >+ '$ORIGIN/..' '$ORIGIN/../..' '$ORIGIN/../' '$ORIGIN/../../' \ >+ '$ORIGIN' '$ORIGIN/foo' '$ORIGIN/../foo'; do >+ tellTest "checking '$i'" >+ ! expr match "$i" "$BADNESS_EXPR_32" >/dev/null && tellOk || tellFail >+ done >+ tellTestGroupEnd >+ >+ # bad paths >+ tellTestGroup "Checking bad paths" >+ for i in '/usr/lib/..' '/usr/lib/../lib64' \ >+ '$ORIGIN/lib/..' '$ORIGIN/lib/../' \ >+ '$ORIGIN/lib/../..' '$ORIGIN/lib/../../' \ >+ '$ORIGIN/lib/../lib64' '$ORIGIN/lib/../../lib64' \ >+ '$ORIGIN/../lib/..' '$ORIGIN/../lib/../' '$ORIGIN/../lib/../foo' \ >+ '$ORIGIN/../lib/../..' '$ORIGIN/../lib/../..' '$ORIGIN/../lib/../../foo' \ >+ '$ORIGIN/../../lib/..' '$ORIGIN/../../lib/../' '$ORIGIN/../../lib/../foo' \ >+ '$ORIGIN/../../lib/../..' '$ORIGIN/../../lib/../..' '$ORIGIN/../../lib/../../foo' \ >+ ; do >+ tellTest "checking '$i'" >+ expr match "$i" "$BADNESS_EXPR_32" >/dev/null && tellOk || tellFail >+ done >+ tellTestGroupEnd >+tellTestGroupEnd >+ >+tellResult
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 245639
: 158375