Summary: | Allow for patching LTP sources | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | mcermak |
Component: | general | Assignee: | mcermak |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | mark |
Priority: | NOR | ||
Version First Reported In: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
proposed patch
proposed patch proposed patch proposed patch |
That should work, except if there are no patches, then: +for i in *.patch; do + patch -d "$LTP_SRC_DIR" -p1 < "$i" +done will not match anything and you end up with i being literally "*.patch" which causes the patch < "*.patch" to fail. Since applypatches.sh is a bash script you could do: if compgen -G "*.patch"; then for i in *.patch; do patch -d "$LTP_SRC_DIR" -p1 < "$i" done fi Which should also work when there aren't any *patch files around. O, and I think this: @@ -199,6 +199,7 @@ $(LTP_SRC_DIR): $(LTP_TAR) echo "$(LTP_SHA256_SUM) $(LTP_TAR)" | @SHA256SUM@ --check - (cd $(AUX_CHECK_DIR) && \ tar Jxf $(LTP_TAR_NAME) && \ + ../ltp-patches/apply-patches.sh $(LTP_SRC_DIR) && \ cd $(LTP_SRC_DIR) && \ ./configure CC="${CC}" CXX="${CXX}" CFLAGS="$(LTP_CFLAGS)" && \ ${MAKE} -j $(nproc) -C testcases/kernel/syscalls) Should be: + $(abs_top_srcdir)/auxprogs/ltp-patches/apply-patches.sh $(LTP_SRC_DIR) && \ In case you are building with srcdir != builddir (untested) Created attachment 183810 [details]
proposed patch
Thank you for your review! I'm attaching an updated patch. Please check.
(In reply to mcermak from comment #3) > Created attachment 183810 [details] > proposed patch > > Thank you for your review! I'm attaching an updated patch. Please check. > +if test -f ltp-patches/*.patch; then That won't work when there are multiple patches: $ touch 1.patch 2.patch; if test -f *.patch; then echo yes; else echo no; fi bash: test: 1.patch: binary operator expected no Which is why I would recommend using if compgen -G "*.patch"; Created attachment 183818 [details]
proposed patch
Apologies. I've updated the patch using compgen now. Please check.
Created attachment 183822 [details]
proposed patch
Improve README and commit message.
(In reply to mcermak from comment #6) > Created attachment 183822 [details] > proposed patch > > Improve README and commit message. Looks good. Pushed as: commit 03ea5d11d3832fb83a434408a5ea7049392fd4bd Author: Martin Cermak <mcermak@redhat.com> Date: Tue Aug 5 18:06:08 2025 +0200 Allow for patching LTP sources Sometimes there's an upstream LTP patch that helps testing valgrind, but it's not yet part of the official LTP tarball. In such cases it's helpful to be able to patch the LTP sources. Attached patch allows for that. It comes with a real life example patch: LTP commit b62b831cf. Also updated the buildbot to clean the ltpchecks so patches are applied on next run: https://sourceware.org/cgit/builder/commit/?id=a98c6cf9414073a1f44ae77f17f8220be1642914 |
Created attachment 183802 [details] proposed patch Sometimes there's an upstream LTP patch that we need for testing valgrind, but it's not yet part of the released LTP tarball. In such cases it's helpful to be able to conveniently patch the LTP sources as part of the valgrind test process. Attached patch allows for that.