Repository navigation
Conversation
23c2ca4 to
9371940
Compare
|
Bummer: https://github.com/containers/bubblewrap/releases |
9371940 to
8c7197e
Compare
|
It is still a useful tool for running the tests on the local dev machine. Once CI is upgraded we can at least run trixie and sid on parallel tests. |
|
When you propagate To easily add extra options, you may want to make a list of bwrap options like: BWRAPOPTS=(
"--ro-bind" "/" "/"
"--dev" "/dev"
"--tmpfs" "/tmp"
"--tmpfs" "/var/tmp"
"--overlay-src" "$HOME" "--tmp-overlay" "$HOME"
"--overlay-src" "$TOPDIR" "--tmp-overlay" "$TOPDIR"
"--bind" "$TOPDIR/tests" "$TOPDIR/tests"
"--unshare-ipc"
"--unshare-pid"
"--unshare-net"
"--proc" "/proc"
"--die-with-parent"
)
...
CMD="bwrap ${BWRAPOPTS[*]} -- scripts/runtests ${WORKER_OPT[*]} -w {}" |
8c7197e to
35da1e4
Compare
Might be there are options... Backports, i could manually create overlays. Or just build the new bwrap in ci... ;-) As long as one job takes longer, the whole CI run stays constant. |
| c) CLEAN_ONLY=1; WORKER_OPT+=(-c) ;; | ||
| n) NOCLEAN=1 ; WORKER_OPT+=(-n) ;; | ||
| u) NOSUDO=true; WORKER_OPT+=(-u) ;; | ||
| v) VERBOSE=1; WORKER_OPT+=(-v) ;; | ||
| s) STOP=1; WORKER_OPT+=(-s) ;; | ||
| p) PRINT=1; WORKER_OPT+=(-p) ;; | ||
| d) export ENABLE_CRASHDUMPS=1; WORKER_OPT+=(-d) ;; |
There was a problem hiding this comment.
Propagating -c does not make sense. It is resolved immediately below.
Propagating -s does not make sense because each test runs as a singular instance that always stops. However, parallel can be instructed to stop processing files when one process fails. That is where this option should be redirected to.
Propagating -d probably requires extra bwrap options to ensure the crash dump is accessible.
This option binds the whole test folder, so the results are directly written to the host's filesystem:
Thanks, looks better. |
That is a problem. Running parallel tests may have side effects. Some tests share files that are not meant to be accessed/changed in parallel. |
Hmm, are you sure? Each test is in a separate folder and I guess it should not write files in an other folder. I could bind a temporary folder for each test, copy all content in and at the end, copy the results together. But this would be cumbersome. Might be there is an overlay option to do something similar, just more efficient. |
35da1e4 to
2e6f540
Compare
Yes, some tests share stuff. Most often they are in a sub-subdirectory of tests. For example, there are written variable files or intermediaries. The only two files we know of that should move out of the overlay are |
Do you have an example of such a test? For the gui tests, there are also some images needed. I need to see how to move files out of overlays with bwrap. Just rebased on top of #4477 to see how well it works but in CI, some tests fail. And in CI+Docker, there are still permission issues. Any clue where: But 14min down to 1m45 would be quite an improvement. In CI, doc's are anyway the longest running process, so it would not decrease the overall runtime, just the worker usage. Locally, it would be nice anyway. |
08005c8 to
f21f2ce
Compare
|
Sorry about the many CI runs. Locally all works but in CI not. However, I found a bug: There are also other strange issues but they also appear only in CI, like Due to it will anyway not work in CI until it is updated until #4477 is merged, it would probably make sense to get this working in CI later and have parallel mode only for local testing. I found a way to get the newly created files out of the overlay, so everything can be isolated. See last commit. It is a bit cumbersome and but it seams to work. |
8b06051 to
dd77bd8
Compare
|
@grandixximo @BsAtHome Reducing the number of jobs from 32 to 8 reduces the failed tests and sometimes also no fail except the GCC G71 issue. Here, only one test fails with no obvious reason: https://github.com/LinuxCNC/linuxcnc/actions/runs/37964686002/job/113936125329?pr=4648 Parallel runtests with installed debian packages are still broken, I am on it, looks like a path issue from my side. |
ba9f388 to
58c9f9e
Compare
|
So, after some messing around with github-ci / docker and so on:
Looks like getting it to run in CI with Debian packages is something between a lot of effort to not possible. In CI for the rest of the jobs looks possible but needs #4477 So I moved the CI integration to an other branch for later: https://github.com/hdiethelm/linuxcnc-fork/tree/tests_parallel_v2_ci I think parallel tests are still useful for quick local testing. In CI, it is anyway less useful due to the total runtime is set by the doc build. |
The first stat.poll() in a process tried tool_mmap_user() once. If task had not created ~/.tool.mmap yet, a static flag latched and every later poll() returned NULL without setting an exception, so Python raised SystemError forever and a new linuxcnc.stat() did not help. A stale ~/.tool.mmap from an earlier run hid it; isolated test runs and a fresh HOME failed every time. Retry the attach on each poll until it succeeds and leave initialized at 0 meanwhile, so tool_table and toolinfo report no data instead of touching a NULL mapping. poll() warns once, and says when the mmap became available, so the warning does not read as a failure (hdiethelm asked for that after hunting the cause in CI logs). tool_mmap_user() warns once and names the file and the step that failed: open or fstat with the errno, or a file still shorter than the mapping. The creator truncates before extending, and mapping the file in that window would SIGBUS on first access, so a short file counts as absent. BsAtHome asked for the reason and the size_t comparison. Drop the drive.py comment that described the SystemError as normal startup noise. Fixes LinuxCNC#4656
58c9f9e to
cfe1037
Compare
|
So, squashed, a few bugs fixed and rebased on top of #4658 What I tested so far:
The contents of the tests folders after the tests look quite similar, no files missing but there are differences like pid / times and so on. So after the round trough the overlayfs, all files arrive correctly in tests. At least on my PC, it passes most of the time with: I have the feeling that some tests are just a bit flaky. Now that you can run the tests really fast, it just surfaces. I will run the original tests in a loop for a day or so to see if I have similar issues. But it might also be that something is not properly isolated and there are rare races. One issue: parallel mode only works in run_in_place without -u due to sudo is never used with run_in_place. An option to fix this issue would be to run all sudo tests sequential after running the other tests when run_in_place is not active. Then it would even work in CI + Debian package. |
|
@BsAtHome maybe cleanup all the uneccesary sudo from the CI First? I can look into that if you give the go ahead :-) |
I think this test for example needs sudo when run with debian package installed: So as long as one test needs sudo in this case, either no parallel or the sequential/parallel fix. Can you test if this branch also works on your PC? Due to all the issues I had in CI, it is well possible that there are also issues on other PC's. |
|
Tested on my machine: Debian 13, 8 cores, 15 GB, bwrap 0.12.0, GNU parallel 20240222, the whole run nested inside my own bwrap sandbox under a 6 GB memory cap.
I did not hit the hal-show owner id flake in these runs. Failure detection works: with a bogus line appended to One difference from sequential mode: without Nit: the summary reads |
Yes, all unnecessary sudo should be eliminated. Generally, you wouldn't allow sudo to run during local runs or when building a package. That would be a potential security risk. |
This is clearly a race condition. It shows the order of component creation differs. The component ID increments by one on every The solution is to ignore the component ID in the test result comparison. The race cannot be solved easily because there are multiple calls to |
This allows to run tests in parallel using bwarp for isolation of the linuxcnc processes
cfe1037 to
c9fe3d7
Compare
Nice, thanks for testing. Yes, this tests are mostly flaky in CI with 32 jobs and 4 cpu's. Locally, I only have a fail ~1 in 10 runs, even if I go up to 128 threads. I need to test this in a CPU limited VM or on my slow CNC pc. Right now, I run it with 16 cores (9950X) and 96GB RAM. I was lucky to upgrade my PC before AI hit... :-)
The reason behind this was, that the CI failed and I expected the different overlay mounts to be an issue. Looks like this was not the case, changed back to copy back always.
Yes, the reason behind was consistency check during developing. I added the check in code and changed the output to be equal. Now it shows: |
tests/halcompile/userspace-count-names uses sudo but does not declare it
|
So while this is still true: |
|
Finally, I got everything running in CI: #4665 Just the G71 tests fail due to the GCC issue. There was indeed an issue with overlaying directory's to It cuts down the runtime from 16-19 min to 7-8 min for the jobs switched to parallel except for bookworm where bwrap is to old. So I wait until #4658 is merged and #4663 has settled and then call this ready. I solved the sudo problem, so #4663 is not absolutely necessary. But if it is decided to remove sudo tests, it should go in first. Still open from my side: Check for flaky tests |
This adds a parallel execution mode for runtests and uses it in CI.
The linuxcnc instances are isolated using bwrap, so this works without #2722
Solves: #4588
Additionally, I fixed the issue that ctrl-c did not work with runtests.
ToDo:
TBD if an issue:
--keep-orderwould allow to keep the order. However:parallel: Warning: No more file handles.with many threads