Page MenuHomeFreeBSD

bc: Fix tests
Needs ReviewPublic

Authored by des on Sun, Apr 19, 11:23 AM.
Tags
None
Referenced Files
F154046756: D56511.diff
Sat, Apr 25, 5:42 PM
F153981390: D56511.diff
Sat, Apr 25, 6:07 AM
Unknown Object (File)
Fri, Apr 24, 7:09 PM
Unknown Object (File)
Wed, Apr 22, 8:21 AM
Subscribers

Details

Reviewers
se
Summary
  • Fix typo in upstream all.sh.
  • Stop generating test scripts at build time. The dc test script is broken and simply fixing the code that generates it won't help as there is no reliable way to ensure it gets regenerated if it already exists in the object tree.

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 72334
Build 69217: arc lint + arc unit

Event Timeline

des requested review of this revision.Sun, Apr 19, 11:23 AM

we only need to delete the sh files

The author of this BC / DC has asked me to not create a fork.
The typo in all.sh has been reported by me and fixed in upstream commit 3887cc1.
The author offered to tag a version 7.1.1, but since it did not affect FreeBSD (usage() in all.sh is not used on FreeBSD, since valid parameters are being passed), I did not ask for it.
The script tests are only relevant for the port, since they depend on a previous version of BC / DC installed on the system the test is run on.
Since no previous version can be assumed to exist on the base system, there is no way to generate the expected outputs from a binary other than the one to be tested.

What is the rationale for these patches?
The tests work for me without any issues:

# kyua test usr.bin/gh-bc
usr.bin/gh-bc/bc_tests:main  ->  passed  [2.695s]
usr.bin/gh-bc/dc_tests:main  ->  passed  [0.863s]

Results file id is usr_tests.20260421-185732-311651
Results saved to /root/.kyua/store/results.usr_tests.20260421-185732-311651.db

2/2 passed (0 broken, 0 failed, 0 skipped)

Changes in the contrib directory shall only come from the upstream, as required by the author.
I have been asked to not not apply any local changes to these files, the contents of contrib/bc shall be identical to what is fetched from github.com/gavinhoward/bc.

Version 7.2.0 exists in the upstream repository (contents of VERSION.txt), but has not been tagged and no official release has been cut. I can ask the author for an expected release date.

In D56511#1294670, @se wrote:

The author of this BC / DC has asked me to not create a fork.

This is not “creating a fork”.

The typo in all.sh has been reported by me and fixed in upstream commit 3887cc1.

I'm aware.

What is the rationale for these patches?

The tests are broken.

The tests work for me without any issues:

Because what you have on your machine is not what gets installed by a clean build:

$ cat /usr/obj/home/des/freebsd/src/main/amd64.amd64/usr.bin/gh-bc/tests/dc_tests.sh
#!/bin/sh
env LANG=C BC_TEST_OUTPUT_DIR=\wd  /usr/tests/usr.bin/gh-bc/tests/all.sh -n dc 1 1 0 0 dc

Additionally, the current code will not replace the scripts if they already exist, so if you have an obj tree from before 1a6ffcb27ddc, it will continue to install the older scripts which pass one argument too few to all.sh, triggering its usage() function and running into the print bug.

Changes in the contrib directory shall only come from the upstream, as required by the author.

That is not and has never been our policy, nor does the license prohibit us from making such changes (if it did, we wouldn't have gh-bc in FreeBSD at all). Besides, you've violated this fictional policy yourself in the past, e.g. 9b04aee86ccd, ef5752762ba9, 8c48f4c5377d...

I have been asked to not not apply any local changes to these files, the contents of contrib/bc shall be identical to what is fetched from github.com/gavinhoward/bc.

By whom? Gavin Howard?

Version 7.2.0 exists in the upstream repository (contents of VERSION.txt), but has not been tagged and no official release has been cut. I can ask the author for an expected release date.

Don't hold your breath. Gavin has declared that he will not publish another bc release until his new build system, which he is creating from scratch in a programming language which he is also creating from scratch, is complete.

Thanks for pointing out the typo in dc_tests.sh.
I can see that this typo makes the test fail on the build cluster, when run under an account without write access to /usr/tests/usr.bin/gh-bc.
It worked on my machine when run as root, but that's no excuse ...
I plan to commit these patches after some more testing (for some reason depends_cleanup.sh is not executed during buildworld, but the tests obj directory is removed in stage 2.2, anyway).

In D56511#1295534, @se wrote:

I plan to commit these patches after some more testing

I don't think you understand how Phabricator works...

In D56511#1295534, @se wrote:

(for some reason depends_cleanup.sh is not executed during buildworld, but the tests obj directory is removed in stage 2.2, anyway).

depends-cleanup.sh always runs twice during buildworld, the one that matters for our purposes is the second one.