We have a number of issues like #931, #843, #834, #835, #568, #395, and more closed issues that could be caught with automated tests (e.g. unit-tests) included with the browser code.
Furthermore, the size and scale of the patches in ungoogled-chromium continue to grow. Notably, Safe Browsing continues to grow and integrate itself deeper into the browser with every new version; This is resulting in enormous patches that are increasingly difficult to reason through.
If we want ungoogled-chromium to grow while remaining stable and reliable, we need to grow our development practices. I believe the most impactul action to take towards this goal is to integrate automated testing.
Since we have never considered automated testing before, there will be quite a bit of work involved. This will take time, so we will want to break this up into multiple stages. Here's a rough plan:
I will update this plan as we continue to learn more.
disregard my previous comment, thanks
I am wondering how it will be possible to write tests that works without actually build the whole thing? Because from my experience a lot of these problems pop up very late during building, even in the last linking step. Then again if the test needs to run the building process then it will be too resource intensive (CircleCI free plan has max 2 shared CPU+4GB which will make building Linux version take ~10 hours I believe), so it seems a very difficult task.
@wchen342
I am wondering how it will be possible to write tests that works without actually build the whole thing? Because from my experience a lot of these problems pop up very late during building, even in the last linking step.
It might actually require more compilation than a regular build. My understanding is that there are two kinds of tests: browser tests, and unit tests. Running the browser tests requires building most of the browser and the tests themselves, so it may require more time than a regular build.
Also, a large project like Chromium has a lot of tests. If the time to run tests is a problem, we can consider optimizing the runtime by excluding tests that are not affected by our changes.
Then again if the test needs to run the building process then it will be too resource intensive (CircleCI free plan has max 2 shared CPU+4GB which will make building Linux version take ~10 hours I believe), so it seems a very difficult task.
I believe this is currently possible with GitHub Actions; the macOS repo still builds on GitHub Actions (although the builds are failing due to a macOS version incompatibility). I think some other services like OBS can handle this workload too.
In the worst case scenario, we would not have any CI and run the tests on our own machines. I believe this is still better than our informal testing.
@Eloston
So I tried to use Github Actions to run the whole building process on Arch repo: see this. In summary it kind of works, but it almost pushed the 6-hours maximum running time for Github Actions. For some reason Linux build takes much longer than the MacOS version. Looks like my Android version will certainly exceed the maximum runtime.
I also took a look at the documents here, here and here. It seems building the test targets separately without building the whole browser is partially possible (as least for blink). According to this, running all the tests will take way too long, so it will be good news if each of these tests can be built and run separately (Github Actions can run 20 jobs per repo parallelly).
However, since current patches tend to eliminate codes related to tests, and pruning/domain substitution also changed some of those files, probably it will take a lot of changes to successfully build and run the tests.
@wchen342, the macOS VMs have more resources (4 CPUs, 12 GB RAM) than the Linux (and Windows?) VMs – you could try running via Docker on macOS, I think it used to be installed in the beta, however it's currently __not__ listed. Maybe you can install it via brew or brew cask on a macOS VM
Hardware:
Hardware Overview:
Model Name: Apple device
Model Identifier: VMware7,1
Processor Speed: 3.33 GHz
Number of Processors: 4
Total Number of Cores: 4
L2 Cache (per Processor): 256 KB
L3 Cache (per Processor): 12 MB
Memory: 12 GB
@kramred Interesting, because I looked at Github help and it says Each virtual machine has the same hardware resources. Maybe they changed this recently?
@wchen342 · They have stated that since the beta, but from the first time I checked during the beta till recently (I think still now) the macOS VMs have had higher specs.
I think they ran the macOS VMs on non-Apple hardware during the beta and then switched to MacStadium but mostly kept the specs (except for the OS version and some of the installed software); I have not checked the actual specs for the Windows VMs but the Linux ones are as stated in the support document. As this is owned/run by Microsoft now I think they might actually be using Windows as host system and VMware for virtualisation (not that it matters much).
@kramred I just tried and you are right about the hardware. However as far as I tried I cannot get Docker to run properly on macOS because Docker needs Virtualbox as its driver but macOS blocks installation of Virtualbox by default, and either GUI or Recovery mode is needed to unblock that. The legacy xhyve kind of works but it is deprecated and unstable so I think that's probably not a good solution.
Edit: It seems xhyve works most of the time, but occasionally it will time out for unknown reason. Guess it's still better than nothing. Still need to test the overhead of running under a hypervisor though.
@Eloston
Since I have successfully tested auto-build for archlinux and android, I think next step is try to put together a bigger system across the repos. There are two problems needed to solve from here, qouting the original post:
So it turns out chromium comes with a bunch of unit tests with it, and they can be built with ninja just like the usual binary builds. I haven't tested this yet, since I imagine it will require a lot of tweaks through the source codes because of the patches/domain substitution.
Since I have played with Actions for a while now, I have a vague idea on how this should work:
ungoogled-chromium) and platform-specific repos.repository_dispatch to all platform repos (that has a workflow configured, of course).repository_dispatch back to the main repo with build status, triggering the bot to post comments containing build status under the PR.I think I will start testing the second part first since it's easier and we already have auto build for archlinux up and run. If this sounds like a reasonable plan then I will go ahead and start working on it.
If this sounds like a reasonable plan then I will go ahead and start working on it.
Sounds good to me. Feel free to proceed.
So it turns out chromium comes with a bunch of unit tests with it, and they can be built with ninja just like the usual binary builds. I haven't tested this yet, since I imagine it will require a lot of tweaks through the source codes because of the patches/domain substitution.
I see. I am somewhat interested in this aspect from a technical standpoint, so I'll try to look into this at some point and scope out the work required. However if you do get the chance to investigate unit-tests, don't let me block your progress.
Most helpful comment
@wchen342
It might actually require more compilation than a regular build. My understanding is that there are two kinds of tests: browser tests, and unit tests. Running the browser tests requires building most of the browser and the tests themselves, so it may require more time than a regular build.
Also, a large project like Chromium has a lot of tests. If the time to run tests is a problem, we can consider optimizing the runtime by excluding tests that are not affected by our changes.
I believe this is currently possible with GitHub Actions; the macOS repo still builds on GitHub Actions (although the builds are failing due to a macOS version incompatibility). I think some other services like OBS can handle this workload too.
In the worst case scenario, we would not have any CI and run the tests on our own machines. I believe this is still better than our informal testing.