-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use trap(1) to show the testsuite log #957
Conversation
I've tested it manually, by running these same commands in a docker container. |
Reading the logs directly in Github WebUI is very painful. Can you upload them? You have an example at https://github.com/shadow-maint/shadow/blob/master/.github/workflows/runner.yml#L102. This will provide all the logs in a compressed archive in the checks section of the PR. By the way, I think we are already using v4 for this action, so use that one instead of v3. |
Ahh, so there's a way to see cmocka logs? I was quite frustrated in the past when cmocka reported a test failure because I didn't know how to see the logs, and had to manually reproduce the entire build inside a docker container and then cat the log file. :D But, I don't think that's working as intended. See for example:
(BTW, that PR is expected to fail. The reason is the broken strtoi(3bsd) from libbsd. So, if you want to test a patch for a fix, that would be a good PR to test it.) |
BTW, this reminds me of wanting shell scripts that I can run locally to produce the same stuff that we have on github, and safely. When the string-to-numeric hardening patches are applied, this might be my next project. :) And BTW, here's the CI/CD script I wrote for the Linux man-pages on my server. It might be useful: $ ssh www cat /srv/src/alx/linux/man-pages/man-pages.git/hooks/post-update
#!/bin/bash
set -uo pipefail;
cd /home/alx/src/linux/man-pages/man-pages/.bare.git/;
unset $(git rev-parse --local-env-vars);
git fetch srv >/dev/null;
export LANG=C.utf8;
test "$1" = "refs/heads/main" \
&& (
cd /home/alx/src/linux/man-pages/man-pages/main/;
git reset srv/main --hard >/dev/null;
nohup sh <<__EOF__ >/dev/null 2>&1 &
make build-book _LMB=/srv/www/share/dist/man-pages/git/HEAD/man-pages-HEAD.pdf;
__EOF__
)
test "$1" = "refs/heads/contrib" \
&& (
set -Ee;
cd /home/alx/src/linux/man-pages/man-pages/contrib/;
git reset srv/contrib --hard >/dev/null;
make_opts='';
make_opts="$make_opts -j4";
make_opts="$make_opts -Otarget";
make_opts="$make_opts --no-print-directory";
make_opts="$make_opts DISTNAME=man-pages-contrib";
make_target()
{
make $make_opts "$@" 2>&1 \
| sed '/bashrc.*PS1/d';
}
make_target lint;
make_target build-html;
make_target build-pdf;
make_target build-ps;
make_target build-catman;
make_target build-ex;
make_target check;
make_target dist;
) |
I think I never added cmocka logs to the reporting, so that kind of makes sense.
Something must have changed because it was working even when something failed. I'll take a look at it. |
Ok, so it seems it's not possible to get the logs when a command in docker build fails. I know there have been some changes around it with BuildKit, but maybe it never worked. So, as I see it there are two options: either we move all the steps to scripts, or we move them to the Github workflow. Any other idea? |
Except that we can do a trap(1) in the Dockerfile, since each RUN is basically a script.
I like stderr. If we can do both, then that's great. If we need to chose, I'd like to at least have stderr, which can be redirected to anything. |
1757300
to
f9f8dc8
Compare
v1b changes:
|
It ain't the most beautiful thing in the world, but it works: $ cat Dockerfile
FROM debian
RUN bash -c "trap 'echo foo >&2' ERR; false;"
|
v2 changes:
I've also pushed those two commits to to test them. That run has already finished, and it looks good to me: |
I'll merge it already. It shouldn't be risky, given it only changes code running tests. And it might be useful to have this working in stable branches, in case we need to debug any problems. Thanks! |
v2b changes:
|
Otherwise, 'cat testsuite.log' isn't run, since 'set -e' aborts the script earlier. Reviewed-by: "Serge E. Hallyn" <[email protected]> Cc: Iker Pedrosa <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
Reviewed-by: "Serge E. Hallyn" <[email protected]> Cc: Iker Pedrosa <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
Reviewed-by: "Serge E. Hallyn" <[email protected]> Cc: Iker Pedrosa <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
v2c changes:
|
Otherwise, 'cat testsuite.log' isn't run, since 'set -e' aborts the script earlier.