1 # rpmbuild.at: test rpmbuild
3 # Copyright (C) 2007 Ralf Corsépius <corsepiu@fedoraproject.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 AT_BANNER([RPM build])
21 # ------------------------------
22 # Check if rpmbuild -ba *.spec works
23 AT_SETUP([rpmbuild -ba *.spec])
27 AS_MKDIR_P(${TOPDIR}/SOURCES)
29 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
32 -ba "${abs_srcdir}"/data/SPECS/hello.spec
39 # ------------------------------
40 # Check if rpmbuild --rebuild *.src.rpm works
41 AT_SETUP([rpmbuild --rebuild])
47 --rebuild "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
54 AT_SETUP([rpmbuild --short-circuit -bl])
58 AS_MKDIR_P(${TOPDIR}/SOURCES)
60 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
62 run rpmbuild -bi "${abs_srcdir}"/data/SPECS/hello.spec &> /dev/null
63 run rpmbuild --quiet -bl --short-circuit "${abs_srcdir}"/data/SPECS/hello.spec
70 # ------------------------------
71 # Check if tar unpacking works
72 AT_SETUP([rpmbuild -tb <tar with bad spec>])
78 -tb "${RPMDATA}/SOURCES/hello-1.0.tar.gz"
82 [error: line 5: Unknown tag: Serial: 1
86 # ------------------------------
87 # Check if tar build works
88 # TODO: test that the rpms are actually created...
89 AT_SETUP([rpmbuild -tb])
95 -ta "${RPMDATA}/SOURCES/hello-2.0.tar.gz"
102 # ------------------------------
103 # %attr/%defattr tests
104 AT_SETUP([rpmbuild %attr and %defattr])
110 -bb --quiet /data/SPECS/attrtest.spec
112 runroot rpm -qp --qf \
113 "\n[%{filemodes:perms} %-8{fileusername} %-8{filegroupname} %{filenames}\n]"\
114 /build/RPMS/noarch/attrtest-1.0-1.noarch.rpm
118 drwx------ root root /a/dir
119 -r-------- root root /a/file
120 drwx------ daemon adm /b/dir
121 -r-------- daemon adm /b/file
122 drwxr-x--- root adm /c/dir
123 -rw-r----- daemon root /c/file
124 drwxr-x--x daemon bin /d/dir
125 -rw-r--r-- bin daemon /d/file
126 drwx------ foo bar /e/dir
127 -r-------- foo bar /e/file
128 drwxrwx--- bar foo /f/dir
129 -rw-rw---- bar foo /f/file
130 drwx------ adm foo /g/dir
131 -r-------- bar adm /g/file
132 drwxr-xr-x foo bar /h/dir
133 -rw-r--r-- foo bar /h/file
134 drwxr-x--- adm root /i/dir
135 -rwsr-xr-x root adm /i/file
136 drwxrwxrwx zoot zoot /j/dir
137 --w--w--w- zoot zoot /j/file
142 # ------------------------------
144 AT_SETUP([rpmbuild hardlink])
152 -bb --quiet /data/SPECS/hlinktest.spec
154 runroot rpm -i /build/RPMS/noarch/hlinktest-1.0-1.noarch.rpm
156 runroot rpm -q --qf "[[%{filenlinks} %{filenames}\n]]%{longsize}\n" hlinktest
157 runroot rpm -V --nouser --nogroup hlinktest
158 ls -i "${RPMTEST}"/foo/hello* | awk {'print $1'} | sort -u | wc -l
175 AT_SETUP([rpmbuild unpackaged files])
183 -bb --quiet --with unpackaged_files /data/SPECS/hlinktest.spec
187 [error: Installed (but unpackaged) file(s) found:
189 Installed (but unpackaged) file(s) found:
194 # rpm doesn't detect unpackaged directories but should, really
195 AT_SETUP([rpmbuild unpackaged directories])
197 AT_XFAIL_IF([test $RPM_XFAIL -ne 0])
204 -bb --quiet --with unpackaged_dirs /data/SPECS/hlinktest.spec
208 [error: Installed (but unpackaged) file(s) found:
210 Installed (but unpackaged) file(s) found:
215 AT_SETUP([rpmbuild glob])
222 runroot rpmbuild -bb --quiet /data/SPECS/globtest.spec
224 --qf "[[%{filemodes:perms} %{filenames}\n]]" \
225 /build/RPMS/noarch/globtest-1.0-1.noarch.rpm
228 [-rw-r--r-- /opt/globtest/baf
229 drwxr-xr-x /opt/globtest/bang
230 -rw-r--r-- /opt/globtest/bif
231 drwxr-xr-x /opt/globtest/bing
232 drwxr-xr-x /opt/globtest/bong
233 drwxr-xr-x /opt/globtest/foo
234 -rw-r--r-- /opt/globtest/foo/one
235 -rw-r--r-- /opt/globtest/foo/three
236 -rw-r--r-- /opt/globtest/foo/two
237 lrwxrwxrwx /opt/globtest/linkbad
238 lrwxrwxrwx /opt/globtest/linkgood
239 -rw-r--r-- /opt/globtest/weird%name
240 -rw-r--r-- /opt/globtest/zab
241 -rw-r--r-- /opt/globtest/zeb
242 -rw-r--r-- /opt/globtest/zib
247 AT_SETUP([rpmbuild prefixpostfix])
254 runroot rpmbuild -bb --quiet \
255 /data/SPECS/prefixtest.spec
257 --qf "[[%{filemodes:perms} %{filenames}\n]]" \
258 /build/RPMS/noarch/prefixtest-1.0-1.noarch.rpm
261 [-rw-r--r-- /opt/prefixtest/ba
262 drwxr-xr-x /opt/prefixtest/ban
263 -rw-r--r-- /opt/prefixtest/bi
264 drwxr-xr-x /opt/prefixtest/bin
265 drwxr-xr-x /opt/prefixtest/bon
266 drwxr-xr-x /opt/prefixtest/foo
267 -rw-r--r-- /opt/prefixtest/foo/one
268 -rw-r--r-- /opt/prefixtest/foo/three
269 -rw-r--r-- /opt/prefixtest/foo/two
270 lrwxrwxrwx /opt/prefixtest/linkbad
271 lrwxrwxrwx /opt/prefixtest/linkgood
272 -rw-r--r-- /opt/prefixtest/weird%name
273 -rw-r--r-- /opt/prefixtest/zab
274 -rw-r--r-- /opt/prefixtest/zeb
275 -rw-r--r-- /opt/prefixtest/zib
280 # ------------------------------
281 # Check if weak and reverse requires can be built
282 AT_SETUP([Weak and reverse requires])
286 runroot rpmbuild -bb --quiet \
287 --define "pkg weakdeps" \
288 --define "recs foo > 1.2.3" \
289 --define "sugs bar >= 0.1.2" \
290 --define "sups baz" \
291 --define "ens zap = 3" \
292 /data/SPECS/deptest.spec
294 runroot rpm -qp --recommends /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm
295 runroot rpm -qp --suggests /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm
296 runroot rpm -qp --supplements /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm
297 runroot rpm -qp --enhances /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm
308 # ------------------------------
309 # Test BuildRequire functionality
310 AT_SETUP([Build requires])
314 runroot rpmbuild -bb --quiet \
315 --define "pkg buildreq" \
316 --define "buildreqs foo > 1.2.3" \
317 /data/SPECS/deptest.spec
321 [error: Failed build dependencies:
322 foo > 1.2.3 is needed by deptest-buildreq-1.0-1.noarch
326 AT_SETUP([Dependency generation])
330 runroot rpmbuild -bb --quiet \
331 /data/SPECS/filedep.spec
333 runroot rpm -qp --requires /build/RPMS/noarch/filedep-1.0-1.noarch.rpm
335 runroot rpm -qp --provides /build/RPMS/noarch/filedep-1.0-1.noarch.rpm
337 runroot rpm -qp --qf '[["%{FILENAMES}\t%{FILEREQUIRE}"\n]]' /build/RPMS/noarch/filedep-1.0-1.noarch.rpm
339 runroot rpm -qp --qf '[["%{FILENAMES}\t%{FILEPROVIDE}"\n]]' /build/RPMS/noarch/filedep-1.0-1.noarch.rpm
345 rpmlib(CompressedFileNames) <= 3.0.4-1
346 rpmlib(FileDigests) <= 4.6.0-1
347 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
352 "/usr/bin/bar /bin/f00f"
353 "/usr/bin/foo /bin/sh"
354 "/usr/share/doc/filedep "
355 "/usr/share/doc/filedep/README "
360 "/usr/share/doc/filedep "
361 "/usr/share/doc/filedep/README "
367 # ------------------------------
368 # Test spec query functionality
369 AT_SETUP([rpmspec query 1])
375 --define "reqs foo > 1.2.3 bar <= 2.3" \
377 /data/SPECS/deptest.spec
387 # ------------------------------
388 # archive sanity check
389 AT_SETUP([rpmbuild archive sanity])
395 -bb --quiet /data/SPECS/attrtest.spec
398 /build/RPMS/noarch/attrtest-1.0-1.noarch.rpm > /tmp/attrtest.cpio
405 # ------------------------------
406 # Check if rpmbuild creates the minisymtab section in the main hello binary
407 AT_SETUP([rpmbuild debuginfo minisymtab])
408 AT_KEYWORDS([build] [debuginfo])
412 # Use macros.debug to generate a debuginfo package.
414 rundebug rpmbuild --quiet \
415 --rebuild "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
417 # Extract the main package and inspect the hello binary
418 # It should contain .gnu_debugdata, but not the full .symtab
419 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-1.*.rpm | cpio -diu
420 test -f ./usr/local/bin/hello || exit 1
421 readelf -S ./usr/local/bin/hello |\
422 grep -q .gnu_debugdata; test $? == 0 || exit 1
423 readelf -S ./usr/local/bin/hello \
424 | grep -q .symtab; test $? == 1 || exit 1
426 # And the opposite for the debuginfo package
427 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-debuginfo-1.0-1.*.rpm \
429 test -f ./usr/lib/debug/usr/local/bin/hello*.debug || exit 1
430 readelf -S ./usr/lib/debug/usr/local/bin/hello*.debug \
431 | grep -q .gnu_debugdata; test $? == 1 || exit 1
432 readelf -S ./usr/lib/debug/usr/local/bin/hello*.debug \
433 | grep -q .symtab; test $? == 0 || exit 1
440 # ------------------------------
441 # Check if rpmbuild doesn't create the minisymtab section if we keep symtab
442 # Some package might want to use strip -g to keep the symbol table and only
443 # but the debug symbols/info in the debuginfo package.
444 AT_SETUP([rpmbuild debuginfo minisymtab strip -g])
445 AT_KEYWORDS([build] [debuginfo])
449 # Use macros.debug to generate a debuginfo package.
451 rundebug rpmbuild --quiet \
452 --define="_find_debuginfo_opts -g" \
453 --rebuild "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
455 # Extract the main package and inspect the hello binary
456 # It should contain .symtab (because of strip -g), so doesn't .gnu_debugdata.
457 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-1.*.rpm | cpio -diu
458 test -f ./usr/local/bin/hello || exit 1
459 readelf -S ./usr/local/bin/hello \
460 | grep -q .gnu_debugdata; test $? == 1 || exit 1
461 readelf -S ./usr/local/bin/hello \
462 | grep -q .symtab; test $? == 0 || exit 1
464 # The debuginfo package should contain neither. The .symtab is NOBITS.
465 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-debuginfo-1.0-1.*.rpm \
467 test -f ./usr/lib/debug/usr/local/bin/hello*.debug || exit 1
468 readelf -S ./usr/lib/debug/usr/local/bin/hello*.debug \
469 | grep -q .gnu_debugdata; test $? == 1 || exit 1
470 readelf -S ./usr/lib/debug/usr/local/bin/hello*.debug \
471 | grep .symtab | grep -q NOBITS; test $? == 0 || exit 1
478 # ------------------------------
479 # Check if rpmbuild runs dwz and generates a multi file that with shared
480 # debuginfo. This is simply the hello example with one binary build twice
481 # so dwz has enough slightly similar debug data.
482 # Test the case without unique debug file names.
483 AT_SETUP([rpmbuild debuginfo dwz])
484 AT_KEYWORDS([build] [debuginfo] [dwz])
487 AS_MKDIR_P(${TOPDIR}/SOURCES)
489 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
491 rundebug rpmbuild --quiet \
492 --undefine "_unique_debug_names" \
493 --undefine "_unique_debug_srcs" \
494 -ba "${abs_srcdir}"/data/SPECS/hello2.spec
496 # The debuginfo package should contain a .debug file for each binary
497 # and a dwz multi file that contains the shared debuginfo between them.
498 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debuginfo-1.0-1.*.rpm \
501 hello_file_debug=./usr/lib/debug/usr/local/bin/hello.debug
502 hello2_file_debug=./usr/lib/debug/usr/local/bin/hello2.debug
503 hello_multi_file=./usr/lib/debug/.dwz/hello2-1.0-1.*
504 test -f $hello_file_debug || echo "no hello debug file: $hello_file_debug"
505 test -f $hello2_file_debug || echo "no hello2 debug file: $hello2_file_debug"
506 test -f $hello_multi_file || echo "no dwz multi file: $hello_multi_file"
508 # Make sure the main package binaries contain the correct build-ids
509 # linking them to the debug packages.
510 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
512 hello_file=./usr/local/bin/hello
513 hello2_file=./usr/local/bin/hello2
514 test -f $hello_file || echo "no hello file: $hello_file"
515 test -f $hello2_file || echo "no hello2 file: $hello2_file"
517 id1=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
518 id2=$(file $hello2_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
519 id1debug=$(file $hello_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
520 id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
521 idmulti=$(file $hello_multi_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
523 test "$id1" = "$id1debug" || echo "id1: $id1 != id1debug: $id1debug"
524 test "$id2" = "$id2debug" || echo "id2: $id2 != id2debug: $id2debug"
526 # The build-id files should link to the .debug files.
527 id1file="./usr/lib/debug/.build-id/${id1:0:2}/${id1:2}"
528 canonid1file=$(readlink -f ${id1file})
529 canonfile1=$(readlink -f $hello_file)
530 canonid1debug=$(readlink -f ${id1file}.debug)
531 canondebug1=$(readlink -f $hello_file_debug)
533 test "$canonid1file" = "$canonfile1" \
534 || echo "canonid1file: $canonid1file != $canonfile1"
535 test "$canonid1debug" = "$canondebug1" \
536 || echo "canonid1debug: $canonid1debug != $canondebug1"
538 id2file="./usr/lib/debug/.build-id/${id2:0:2}/${id2:2}"
539 canonid2file=$(readlink -f ${id2file})
540 canonfile2=$(readlink -f $hello2_file)
541 canonid2debug=$(readlink -f ${id2file}.debug)
542 canondebug2=$(readlink -f $hello2_file_debug)
544 test "$canonid2file" = "$canonfile2" \
545 || echo "canonid2: $canonid2file != $canonfile2"
546 test "$canonid2debug" = "$canondebug2" \
547 || echo "canonid2debug: $canonid2debug" != "$canondebug2"
549 # Both .debug files should point to the dwz multi file.
550 # It would be nice to also test that they contain the correct dwz build-id
551 # but that is a bit hard to grep out of the section data.
552 multiref1=$(readelf --string-dump=.gnu_debugaltlink $hello_file_debug \
553 | grep '[ 0]' | cut -c13-)
554 multiref2=$(readelf --string-dump=.gnu_debugaltlink $hello2_file_debug \
555 | grep '[ 0]' | cut -c13-)
557 test "$multiref1" = "$multiref2" || echo "multiref: $multiref1 != $multiref2"
559 canonmultiref=$(readlink -f $(dirname $canondebug1)/$multiref1)
560 canonmultifile=$(readlink -f $hello_multi_file)
562 test "$canonmultiref" = "$canonmultifile" \
563 || echo "canonmultiref: $canonmultiref" != "$canonmultifile"
570 # ------------------------------
571 # Check if rpmbuild runs dwz and generates a multi file that with shared
572 # debuginfo. This is simply the hello example with one binary build twice
573 # so dwz has enough slightly similar debug data.
574 # Test with unique debug file names.
575 AT_SETUP([rpmbuild debuginfo dwz unique debug names])
576 AT_KEYWORDS([build] [debuginfo] [dwz])
579 AS_MKDIR_P(${TOPDIR}/SOURCES)
581 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
583 rundebug rpmbuild --quiet \
584 --define "_unique_debug_names 1" \
585 -ba "${abs_srcdir}"/data/SPECS/hello2.spec
587 # The debuginfo package should contain a .debug file for each binary
588 # and a dwz multi file that contains the shared debuginfo between them.
589 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debuginfo-1.0-1.*.rpm \
592 hello_file_debug=./usr/lib/debug/usr/local/bin/hello-*.debug
593 hello2_file_debug=./usr/lib/debug/usr/local/bin/hello2-*.debug
594 hello_multi_file=./usr/lib/debug/.dwz/hello2-1.0-1.*
595 test -f $hello_file_debug || echo "no hello debug file: $hello_file_debug"
596 test -f $hello2_file_debug || echo "no hello2 debug file: $hello2_file_debug"
597 test -f $hello_multi_file || echo "no dwz multi file: $hello_multi_file"
599 # Make sure the main package binaries contain the correct build-ids
600 # linking them to the debug packages.
601 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
603 hello_file=./usr/local/bin/hello
604 hello2_file=./usr/local/bin/hello2
605 test -f $hello_file || echo "no hello file: $hello_file"
606 test -f $hello2_file || echo "no hello2 file: $hello2_file"
608 id1=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
609 id2=$(file $hello2_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
610 id1debug=$(file $hello_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
611 id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
612 idmulti=$(file $hello_multi_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
614 test "$id1" = "$id1debug" || echo "id1: $id1 != id1debug: $id1debug"
615 test "$id2" = "$id2debug" || echo "id2: $id2 != id2debug: $id2debug"
617 # The build-id files should link to the .debug files.
618 id1file="./usr/lib/debug/.build-id/${id1:0:2}/${id1:2}"
619 canonid1file=$(readlink -f ${id1file})
620 canonfile1=$(readlink -f $hello_file)
621 canonid1debug=$(readlink -f ${id1file}.debug)
622 canondebug1=$(readlink -f $hello_file_debug)
624 test "$canonid1file" = "$canonfile1" \
625 || echo "canonid1file: $canonid1file != $canonfile1"
626 test "$canonid1debug" = "$canondebug1" \
627 || echo "canonid1debug: $canonid1debug != $canondebug1"
629 id2file="./usr/lib/debug/.build-id/${id2:0:2}/${id2:2}"
630 canonid2file=$(readlink -f ${id2file})
631 canonfile2=$(readlink -f $hello2_file)
632 canonid2debug=$(readlink -f ${id2file}.debug)
633 canondebug2=$(readlink -f $hello2_file_debug)
635 test "$canonid2file" = "$canonfile2" \
636 || echo "canonid2: $canonid2file != $canonfile2"
637 test "$canonid2debug" = "$canondebug2" \
638 || echo "canonid2debug: $canonid2debug" != "$canondebug2"
640 # Both .debug files should point to the dwz multi file.
641 # It would be nice to also test that they contain the correct dwz build-id
642 # but that is a bit hard to grep out of the section data.
643 multiref1=$(readelf --string-dump=.gnu_debugaltlink $hello_file_debug \
644 | grep '[ 0]' | cut -c13-)
645 multiref2=$(readelf --string-dump=.gnu_debugaltlink $hello2_file_debug \
646 | grep '[ 0]' | cut -c13-)
648 test "$multiref1" = "$multiref2" || echo "multiref: $multiref1 != $multiref2"
650 canonmultiref=$(readlink -f $(dirname $canondebug1)/$multiref1)
651 canonmultifile=$(readlink -f $hello_multi_file)
653 test "$canonmultiref" = "$canonmultifile" \
654 || echo "canonmultiref: $canonmultiref" != "$canonmultifile"
661 # ------------------------------
662 # Check that old style gnu_debuglink CRC checksums are correct even after
663 # using dwz to compress the debuginfo files.
664 AT_SETUP([rpmbuild debuginfo dwz gnu_debuglink crc])
665 AT_KEYWORDS([build] [debuginfo])
668 AS_MKDIR_P(${TOPDIR}/SOURCES)
670 # Build a package that
671 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
673 rundebug rpmbuild --quiet \
674 -ba "${abs_srcdir}"/data/SPECS/hello2.spec
676 # Unpack the main and debuginfo rpms so we can check binaries and .debug files.
677 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debuginfo-1.0-1.*.rpm \
679 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
682 # Check that dwz has ran and a multi file has been produced
683 test -f ./usr/lib/debug/.dwz/hello2-1.0-1.* || exit 1
685 # Run sepdbugcrcfix on the binaries, both should have correct CRC already.
686 ${abs_top_builddir}/sepdebugcrcfix ./usr/lib/debug \
687 ./usr/local/bin/hello ./usr/local/bin/hello2 | grep CRC32 | cut -f2 -d:
690 [ Updated 0 CRC32s, 2 CRC32s did match.
695 # ------------------------------
696 # Check that an implicit suid binary get included with the suid bit set.
697 # We explicitly build with all debug.macros to test those helpers.
698 AT_SETUP([rpmbuild implicit suid binary])
699 AT_KEYWORDS([build] [debuginfo] [dwz] [suid])
702 AS_MKDIR_P(${TOPDIR}/SOURCES)
704 # Build a package that has some debuginfo
705 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
707 rundebug rpmbuild --quiet \
708 -ba "${abs_srcdir}"/data/SPECS/hello2-suid.spec
710 # Unpack rpm so we can check the included binaries.
711 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
714 # List all binaries with suid bit set (should be one, hello).
716 find usr -executable -type f -perm /4000
717 # List all binaries without suid bit set (should also be one, hello2).
719 find usr -executable -type f \! -perm /4000
730 # ------------------------------
731 # Check that a GDB index is included when requested.
732 AT_SETUP([rpmbuild debuginfo gdb index included])
733 AT_KEYWORDS([build] [debuginfo] [gdb])
736 AS_MKDIR_P(${TOPDIR}/SOURCES)
738 # Build a package that has some debuginfo
739 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
741 rundebug rpmbuild --quiet \
742 --define "_include_gdb_index 1" \
743 -ba "${abs_srcdir}"/data/SPECS/hello2.spec
745 # Unpack the debuginfo rpms so we can check the .debug files.
746 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debuginfo-1.0-1.*.rpm \
749 # Check that gdb-add-index has ran and a .gdb_index section has been added
750 readelf -S ./usr/lib/debug/usr/local/bin/hello2*.debug \
751 | grep gdb_index | cut -c8-17
759 # ------------------------------
760 # Check that a GDB index is NOT included when not requested.
761 AT_SETUP([rpmbuild debuginfo no gdb index included])
762 AT_KEYWORDS([build] [debuginfo] [gdb])
765 AS_MKDIR_P(${TOPDIR}/SOURCES)
767 # Build a package that has some debuginfo
768 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
770 rundebug rpmbuild --quiet \
771 --undefine "_include_gdb_index" \
772 -ba "${abs_srcdir}"/data/SPECS/hello2.spec
774 # Unpack the debuginfo rpms so we can check the .debug files.
775 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debuginfo-1.0-1.*.rpm \
778 # Check that gdb-add-index has not ran and no .gdb_index section has been added
779 readelf -S ./usr/lib/debug/usr/local/bin/hello2*.debug \
780 | grep gdb_index | cut -c8-17
787 # ------------------------------
788 # Check that a debug source is in a "unique" directory when requested.
789 AT_SETUP([rpmbuild debuginfo unique debug src dir])
790 AT_KEYWORDS([build] [debuginfo])
793 AS_MKDIR_P(${TOPDIR}/SOURCES)
795 # Build a package that has some debuginfo
796 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
798 # Note that the spec defines hello2 as name, but the source is hello-1.0.
799 # Disable dwz to make debuginfo path rewrite checking easier.
800 rundebug rpmbuild --quiet \
801 --undefine "_find_debuginfo_dwz_opts" \
802 --define "_unique_debug_srcs 1" \
803 -ba "${abs_srcdir}"/data/SPECS/hello2.spec
805 # Unpack the debuginfo rpms so we can check the .debug files.
806 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debuginfo-1.0-1.*.rpm \
809 # Check that the source path is "unique"
810 # Drop the final arch prefix to make the test arch-independent.
811 ls ./usr/src/debug/ | cut -f1,2 -d\.
813 # Check that the source path has been rewritten in the .debug file.
814 # Drop the final arch prefix to make the test arch-independent.
815 readelf --debug-dump=info ./usr/lib/debug/usr/local/bin/hello2*.debug \
816 | grep comp_dir | sed -e 's/\t$//' | cut -f5- -d/ | cut -f1,2 -d\.
825 # ------------------------------
826 # Check that a debug source is NOT in a "unique" directory when not requested.
827 # It will be in the "build directory" name under /usr/src/debug.
828 AT_SETUP([rpmbuild debuginfo no unique debug src dir])
829 AT_KEYWORDS([build] [debuginfo])
832 AS_MKDIR_P(${TOPDIR}/SOURCES)
834 # Build a package that has some debuginfo
835 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
837 # Note that the spec defines hello2 as name, but the source is hello-1.0.
838 # Disable dwz to make debuginfo path rewrite checking easier.
839 rundebug rpmbuild --quiet \
840 --undefine "_find_debuginfo_dwz_opts" \
841 --undefine "_unique_debug_srcs" \
842 -ba "${abs_srcdir}"/data/SPECS/hello2.spec
844 # Unpack the debuginfo rpms so we can check the .debug files.
845 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debuginfo-1.0-1.*.rpm \
848 # Check that the source path is "unique"
851 # Check that the source path has been rewritten in the .debug file.
852 readelf --debug-dump=info ./usr/lib/debug/usr/local/bin/hello2*.debug \
853 | grep comp_dir | sed -e 's/\t$//' | cut -f5- -d/
862 # ------------------------------
863 # Check that defining _debugsource_packages creates -debugsource package
864 AT_SETUP([rpmbuild debugsource])
865 AT_KEYWORDS([build] [debuginfo] [debugsource])
868 AS_MKDIR_P(${TOPDIR}/SOURCES)
870 # Build a package that has some debuginfo
871 cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz "${abs_srcdir}"/data/SOURCES/hello-1.0-modernize.patch ${TOPDIR}/SOURCES
873 rundebug rpmbuild --quiet \
874 --define "_debugsource_packages 1" \
875 -ba "${abs_srcdir}"/data/SPECS/hello2.spec
877 # Unpack the debugsource rpm so we can check the sources are there.
878 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-debugsource-1.0-1.*.rpm \
881 # Check that hello.c is there.
882 ls ./usr/src/debug/hello2-1.0*/
884 # The debuginfo package should recommend the debugsource package (ignore arch).
885 echo -n "Recommends: "
886 run rpm -qp --recommends ${abs_builddir}/testing/build/RPMS/*/hello2-debuginfo-1.0-1.*.rpm | sed -E 's/([[-.a-z0-9]]+)\(.*\) = ([[-.0-9]]+)/\1\(ignore-arch\) = \2/'
890 Recommends: hello2-debugsource(ignore-arch) = 1.0-1
895 # ------------------------------
896 # Check that defining _debugsource_packages creates -debugsource package
897 # even if %install changes the working directory (debugsources.list
898 # should be in expected build dir).
899 AT_SETUP([rpmbuild debugsource debugsources.list path])
900 AT_KEYWORDS([build] [debuginfo] [debugsource])
903 AS_MKDIR_P(${TOPDIR}/SOURCES)
906 cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
908 rundebug rpmbuild --quiet \
909 --define "_debugsource_packages 1" \
910 -ba "${abs_srcdir}"/data/SPECS/hello-cd.spec
912 # Unpack the debuginfo rpms so we can check the sources are there.
913 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debugsource-1.0-1.*.rpm \
916 # Check that hello.c is there.
917 ls ./usr/src/debug/test-1.0*/
925 # ------------------------------
926 # Check that undefining _debuginfo_subpackages creates one single -debuginfo.
927 AT_SETUP([rpmbuild debuginfo subpackages single])
928 AT_KEYWORDS([build] [debuginfo] [debugsubpackage])
931 AS_MKDIR_P(${TOPDIR}/SOURCES)
934 cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
936 rundebug rpmbuild --quiet \
937 --undefine "_unique_debug_names" \
938 --undefine "_unique_debug_srcs" \
939 --undefine "_debugsource_packages" \
940 --undefine "_debuginfo_subpackages" \
941 -ba "${abs_srcdir}"/data/SPECS/test-subpackages.spec
943 # Check that there is just one debuginfo package.
944 ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
946 # Which contains hello.debug
947 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
949 # Extract the debug name from the exe (.gnu_debuglink section, first string)
950 debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
952 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm \
954 if test -f ./usr/lib/debug/bin/$debug_name; then
955 echo "hello debug exists"
957 echo "No hello: $debug_name"
967 # ------------------------------
968 # Check that defining _debuginfo_subpackages creates multiple -debuginfos.
969 AT_SETUP([rpmbuild debuginfo subpackages multiple])
970 AT_KEYWORDS([build] [debuginfo] [debugsubpackage])
973 AS_MKDIR_P(${TOPDIR}/SOURCES)
976 cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
978 rundebug rpmbuild --quiet \
979 --undefine "_unique_debug_names" \
980 --undefine "_unique_debug_srcs" \
981 --undefine "_debugsource_packages" \
982 --define "_debuginfo_subpackages 1" \
983 -ba "${abs_srcdir}"/data/SPECS/test-subpackages.spec
985 # Check that there are 3 debuginfo packages.
986 ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
988 # First contains hello.debug
989 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
991 # Extract the debug name from the exe (.gnu_debuglink section, first string)
992 debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
994 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm \
996 if test -f ./usr/lib/debug/bin/$debug_name; then
997 echo "hello debug exists"
999 echo "No hello: $debug_name"
1002 # Second contains hello2.debug
1003 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-1.0-1.*.rpm \
1005 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1006 debug_name=$(readelf -p .gnu_debuglink ./bin/hello2 | grep hello | cut -c13-)
1008 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm \
1010 if test -f ./usr/lib/debug/bin/$debug_name; then
1011 echo "hello2 debug exists"
1013 echo "No hello2: $debug_name"
1016 # No debugsource package, so sources are in the main debuginfo package.
1017 # Make sure it is recommended.
1018 echo -n "Recommends: "
1019 run rpm -qp --recommends ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm | sed -E 's/([[-.a-z0-9]]+)\(.*\) = ([[-.0-9]]+)/\1\(ignore-arch\) = \2/'
1021 # Third contains hello3.debug
1022 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test3-1.0-1.*.rpm \
1024 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1025 debug_name=$(readelf -p .gnu_debuglink ./bin/hello3 | grep hello | cut -c13-)
1027 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test3-debuginfo-1.0-1.*.rpm \
1029 if test -f ./usr/lib/debug/bin/$debug_name; then
1030 echo "hello3 debug exists"
1032 echo "No hello3: $debug_name"
1035 # No debugsource package, so sources are in the main debuginfo package.
1036 # Make sure it is recommended.
1037 echo -n "Recommends: "
1038 run rpm -qp --recommends ${abs_builddir}/testing/build/RPMS/*/test-test3-debuginfo-1.0-1.*.rpm | sed -E 's/([[-.a-z0-9]]+)\(.*\) = ([[-.0-9]]+)/\1\(ignore-arch\) = \2/'
1044 Recommends: test-debuginfo(ignore-arch) = 1.0-1
1046 Recommends: test-debuginfo(ignore-arch) = 1.0-1
1050 # ------------------------------
1051 # Check that defining _debuginfo_subpackages creates multiple -debuginfos.
1052 # With unique debug and source names
1053 AT_SETUP([rpmbuild debuginfo subpackages multiple unique])
1054 AT_KEYWORDS([build] [debuginfo] [debugsubpackage])
1057 AS_MKDIR_P(${TOPDIR}/SOURCES)
1060 cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
1062 rundebug rpmbuild --quiet \
1063 --define "_unique_debug_names 1" \
1064 --define "_unique_debug_srcs 1" \
1065 --undefine "_debugsource_packages" \
1066 --define "_debuginfo_subpackages 1" \
1067 -ba "${abs_srcdir}"/data/SPECS/test-subpackages.spec
1069 # Check that there are 3 debuginfo packages.
1070 ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
1072 # First contains hello.debug
1073 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
1075 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1076 debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
1078 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm \
1080 if test -f ./usr/lib/debug/bin/$debug_name; then
1081 echo "hello debug exists"
1083 echo "No hello: $debug_name"
1086 # Second contains hello2.debug
1087 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-1.0-1.*.rpm \
1089 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1090 debug_name=$(readelf -p .gnu_debuglink ./bin/hello2 | grep hello | cut -c13-)
1092 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm \
1094 if test -f ./usr/lib/debug/bin/$debug_name; then
1095 echo "hello2 debug exists"
1097 echo "No hello2: $debug_name"
1100 # No debugsource package, so sources are in the main debuginfo package.
1101 # Make sure it is recommended.
1102 echo -n "Recommends: "
1103 run rpm -qp --recommends ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm | sed -E 's/([[-.a-z0-9]]+)\(.*\) = ([[-.0-9]]+)/\1\(ignore-arch\) = \2/'
1105 # Third contains hello3.debug
1106 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test3-1.0-1.*.rpm \
1108 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1109 debug_name=$(readelf -p .gnu_debuglink ./bin/hello3 | grep hello | cut -c13-)
1111 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test3-debuginfo-1.0-1.*.rpm \
1113 if test -f ./usr/lib/debug/bin/$debug_name; then
1114 echo "hello3 debug exists"
1116 echo "No hello3: $debug_name"
1119 # No debugsource package, so sources are in the main debuginfo package.
1120 # Make sure it is recommended.
1121 echo -n "Recommends: "
1122 run rpm -qp --recommends ${abs_builddir}/testing/build/RPMS/*/test-test3-debuginfo-1.0-1.*.rpm | sed -E 's/([[-.a-z0-9]]+)\(.*\) = ([[-.0-9]]+)/\1\(ignore-arch\) = \2/'
1128 Recommends: test-debuginfo(ignore-arch) = 1.0-1
1130 Recommends: test-debuginfo(ignore-arch) = 1.0-1
1134 # ------------------------------
1135 # Check that defining _debuginfo_subpackages creates multiple -debuginfos.
1136 # Unique with debugsources.
1137 AT_SETUP([rpmbuild debuginfo subpackages multiple unique debugsource])
1138 AT_KEYWORDS([build] [debuginfo] [debugsubpackage] [debugsource])
1141 AS_MKDIR_P(${TOPDIR}/SOURCES)
1144 cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
1146 rundebug rpmbuild --quiet \
1147 --define "_unique_debug_names 1" \
1148 --define "_unique_debug_srcs 1" \
1149 --define "_debugsource_packages 1" \
1150 --define "_debuginfo_subpackages 1" \
1151 -ba "${abs_srcdir}"/data/SPECS/test-subpackages.spec
1153 # Check that there are 3 debuginfo packages.
1154 ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
1156 # First contains hello.debug
1157 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
1159 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1160 debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
1162 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm \
1164 if test -f ./usr/lib/debug/bin/$debug_name; then
1165 echo "hello debug exists"
1167 echo "No hello: $debug_name"
1170 # Sources are in debugsource package. Make sure it is recommended.
1171 echo -n "Recommends: "
1172 run rpm -qp --recommends ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm | sed -E 's/([[-.a-z0-9]]+)\(.*\) = ([[-.0-9]]+)/\1\(ignore-arch\) = \2/'
1174 # Second contains hello2.debug
1175 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-1.0-1.*.rpm \
1177 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1178 debug_name=$(readelf -p .gnu_debuglink ./bin/hello2 | grep hello | cut -c13-)
1180 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm \
1182 if test -f ./usr/lib/debug/bin/$debug_name; then
1183 echo "hello2 debug exists"
1185 echo "No hello2: $debug_name"
1188 # Sources are in debugsource package. Make sure it is recommended.
1189 echo -n "Recommends: "
1190 run rpm -qp --recommends ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm | sed -E 's/([[-.a-z0-9]]+)\(.*\) = ([[-.0-9]]+)/\1\(ignore-arch\) = \2/'
1192 # Third contains hello3.debug
1193 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test3-1.0-1.*.rpm \
1195 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1196 debug_name=$(readelf -p .gnu_debuglink ./bin/hello3 | grep hello | cut -c13-)
1198 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test3-debuginfo-1.0-1.*.rpm \
1200 if test -f ./usr/lib/debug/bin/$debug_name; then
1201 echo "hello3 debug exists"
1203 echo "No hello3: $debug_name"
1206 # Sources are in debugsource package. Make sure it is recommended.
1207 echo -n "Recommends: "
1208 run rpm -qp --recommends ${abs_builddir}/testing/build/RPMS/*/test-test3-debuginfo-1.0-1.*.rpm | sed -E 's/([[-.a-z0-9]]+)\(.*\) = ([[-.0-9]]+)/\1\(ignore-arch\) = \2/'
1213 Recommends: test-debugsource(ignore-arch) = 1.0-1
1215 Recommends: test-debugsource(ignore-arch) = 1.0-1
1217 Recommends: test-debugsource(ignore-arch) = 1.0-1
1222 # ------------------------------
1223 # Check that defining _debuginfo_subpackages works with excluded files.
1224 AT_SETUP([rpmbuild debuginfo subpackages multiple excluded])
1225 AT_KEYWORDS([build] [debuginfo] [debugsubpackage] [debugsource])
1228 AS_MKDIR_P(${TOPDIR}/SOURCES)
1231 cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
1233 rundebug rpmbuild --quiet \
1234 --define "_unique_debug_names 1" \
1235 --define "_unique_debug_srcs 1" \
1236 --define "_debugsource_packages 1" \
1237 --define "_debuginfo_subpackages 1" \
1238 -ba "${abs_srcdir}"/data/SPECS/test-subpackages-exclude.spec
1240 # Check that there are 2 debuginfo packages.
1241 ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
1243 # First contains hello.debug
1244 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
1246 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1247 debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
1249 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm \
1251 if test -f ./usr/lib/debug/bin/$debug_name; then
1252 echo "hello debug exists"
1254 echo "No hello: $debug_name"
1257 # Second contains hello2.debug but NOT hello3.debug
1258 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-1.0-1.*.rpm \
1260 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1261 debug_name=$(readelf -p .gnu_debuglink ./bin/hello2 | grep hello | cut -c13-)
1263 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm \
1265 if test -f ./usr/lib/debug/bin/$debug_name; then
1266 echo "hello2 debug exists"
1268 echo "No hello2: $debug_name"
1271 if test -f ./usr/lib/debug/bin/hello3*; then
1272 echo "hello3 debug exists"
1274 echo "No hello3 debug"
1286 # ------------------------------
1287 # Check that defining _debuginfo_subpackages works with RemovePathPostfixes.
1288 AT_SETUP([rpmbuild debuginfo subpackages multiple excluded])
1289 AT_KEYWORDS([build] [debuginfo] [debugsubpackage] [debugsource])
1292 AS_MKDIR_P(${TOPDIR}/SOURCES)
1295 cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
1297 rundebug rpmbuild --quiet \
1298 --define "_unique_debug_names 1" \
1299 --define "_unique_debug_srcs 1" \
1300 --define "_debugsource_packages 1" \
1301 --define "_debuginfo_subpackages 1" \
1302 -ba "${abs_srcdir}"/data/SPECS/test-subpackages-pathpostfixes.spec
1304 # Check that there are 2 debuginfo packages.
1305 ls ${abs_builddir}/testing/build/RPMS/*/*debuginfo*rpm | wc --lines
1307 # First contains hello.debug
1308 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-1.0-1.*.rpm \
1310 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1311 debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
1313 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1.*.rpm \
1315 if test -f ./usr/lib/debug/bin/$debug_name; then
1316 echo "hello debug exists"
1318 echo "No hello: $debug_name"
1321 # remove it, we are going to check the other debuginfo package.
1323 rm ./usr/lib/debug/bin/$debug_name
1324 orig_debugname=$debugname
1326 # Second contains hello.foobar.debug but NOT hello.debug
1327 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-1.0-1.*.rpm \
1329 # Extract the debug name from the exe (.gnu_debuglink section, first string)
1330 debug_name=$(readelf -p .gnu_debuglink ./bin/hello | grep hello | cut -c13-)
1332 rpm2cpio ${abs_builddir}/testing/build/RPMS/*/test-test2-debuginfo-1.0-1.*.rpm \
1334 if test -f ./usr/lib/debug/bin/$debug_name; then
1335 echo "hello.foobar debug exists"
1337 echo "No hello2: $debug_name"
1340 if test -f ./usr/lib/debug/bin/$orig_debugname; then
1341 echo "$orig_debugname exists"
1343 echo "No hello.debug"
1349 hello.foobar debug exists