Re: Help wanted with golang-github-arduino-go-paths-helper
Hi,
On 21/06/2025 18:42, Matthias Geiger wrote:
Hi all,
eventually I want to get golang-github-arduino-go-paths-helper into
Debian as it's the prerequisite for the new CLI tool to flash arduino
microcontrollers.
Its testsuite fails like this though:
dh_auto_test -O--builddirectory=_build -O--buildsystem=golang
cd _build && go test -vet=off -v -p 14 github.com/arduino/go-paths-
helper
[...]
=== RUN TestFilterOutDirs
paths_test.go:313: Error Trace: /build/reproducible-
path/golang-github-arduino-go-paths-helper-1.13.1/_build/src/github.com/
arduino/go-paths-helper/paths_test.go:313
Error: "[testdata/broken_symlink/dir_1/file2
testdata/broken_symlink/dir_1/linked_dir testdata/broken_symlink/dir_1/
linked_dir/file1 testdata/broken_symlink/dir_1/linked_file testdata/
broken_symlink/dir_1/real_dir testdata/broken_symlink/dir_1/real_dir/
file1]" should have 7 item(s), but has 6
Test: TestFilterOutDirs
--- FAIL: TestFilterOutDirs (0.00s)
[...]
--- PASS: TestReadDirRecursiveFiltered (0.00s)
=== RUN TestReadDirRecursiveLoopDetection
readdir_test.go:312: Error Trace: /build/reproducible-
path/golang-github-arduino-go-paths-helper-1.13.1/_build/src/github.com/
arduino/go-paths-helper/readdir_test.go:312
Error: "[testdata/loops/regular_3/dir1 testdata/
loops/regular_3/dir1/file1 testdata/loops/regular_3/dir2 testdata/loops/
regular_3/dir2/dir1 testdata/loops/regular_3/dir2/dir1/file1 testdata/
loops/regular_3/dir2/file2]" should have 7 item(s), but has 6
Test: TestReadDirRecursiveLoopDetection
--- FAIL: TestReadDirRecursiveLoopDetection (0.07s)
FAIL
FAIL github.com/arduino/go-paths-helper 1.481s
FAIL
dh_auto_test: error: cd _build && go test -vet=off -v -p 14 github.com/
arduino/go-paths-helper returned exit code 1
Any ideas why this happens ? I'm not much of a GO expert, this looks
like a one-off to me. Would appreciate some pointers so this can be
packaged.
I don't know if you noticed, but a previous version of this package has
been already pushed to salsa [1]. I am also interested in packaging
arduino-cli, so at one point I started working on a newer version of
this package.
IIRC these two error simply comes from omitted files in test
directories. I fixed it this way:
--- a/debian/rules
+++ b/debian/rules
@@ -1,6 +1,20 @@
#!/usr/bin/make -f
-export DH_GOLANG_INSTALL_EXTRA := _testdata
+# We want exclude the testdata directory from the go sources and
configure it
+# manually as it contains broken symlinks that are ignored by default by
+# dh_auto_configure.
+# We also want to remove it from the built package as it contains a binary
+# program built from the tests.
+export DH_GOLANG_EXCLUDES := testdata/
+export DH_GOLANG_EXCLUDES_ALL := 1
+
+BUILDDIR=debian/build
%:
- dh $@ --buildsystem=golang --with=golang
+ dh $@ --builddir=$(BUILDDIR) --buildsystem=golang
+
+execute_after_dh_auto_configure:
+# Manually copy the testdata directory in the builddir the following tests:
+# - TestFilterOutDirs
+# - TestReadDirRecursiveLoopDetection
+ cp -r testdata $(BUILDDIR)/src/github.com/arduino/go-paths-helper
I will push my work to the salsa repo so that you can continue based on
it if you'd like.
[1]
https://salsa.debian.org/go-team/packages/golang-github-arduino-go-paths-helper
--
Nicolas Peugnet
Reply to: