I'm porting Lepton EDA to OpenBSD, and in the process have
discovered a bug in our test suite: when make check is run
under root account, two liblepton tests fail: "config-load-grp"
in geda-config.scm and lepton-config.scm.
( chmod *testdirAconf* #o000 )
( test-assert-thrown 'system-error (config-load! a #:force-load #t) )It turned out that root user can read file with 000 permissions,
so the test-assert-thrown fails here.
We can check uid and skip the test if getuid() == 0, or simply
remove it.
What do you think, friends?
I have tested it on OpenBSD, FreeBSD and Ubuntu.
diff --git a/liblepton/scheme/unit-tests/geda-config.scm b/liblepton/scheme/unit-tests/geda-config.scm
index 65079d4eb..67be782c1 100644
--- a/liblepton/scheme/unit-tests/geda-config.scm
+++ b/liblepton/scheme/unit-tests/geda-config.scm
@@ -92,8 +92,9 @@
(test-equal #f (geda:config-loaded? a))
(test-equal a (geda:config-load! a))
(test-assert (geda:config-loaded? a))
- (chmod *testdir-geda-Aconf* #o000) ;; Make conf unreadable
- (test-assert-thrown 'system-error (geda:config-load! a #:force-load #t)))
+ (unless (eq? (getuid) 0)
+ (chmod *testdir-geda-Aconf* #o000) ;; Make conf unreadable; root can read it anyway
+ (test-assert-thrown 'system-error (geda:config-load! a #:force-load #t))))
(test-assert-thrown 'system-error (geda:config-load! (geda:default-config-context) #:force-load #t))
;; Clean up.
diff --git a/liblepton/scheme/unit-tests/lepton-config.scm b/liblepton/scheme/unit-tests/lepton-config.scm
index eb4f996f1..9c337d4e0 100644
--- a/liblepton/scheme/unit-tests/lepton-config.scm
+++ b/liblepton/scheme/unit-tests/lepton-config.scm
@@ -92,8 +92,9 @@
(test-equal #f (config-loaded? a))
(test-equal a (config-load! a))
(test-assert (config-loaded? a))
- (chmod *testdirAconf* #o000) ;; Make conf unreadable
- (test-assert-thrown 'system-error (config-load! a #:force-load #t)))
+ (unless (eq? (getuid) 0)
+ (chmod *testdirAconf* #o000) ;; Make conf unreadable; root can read it anyway
+ (test-assert-thrown 'system-error (config-load! a #:force-load #t))))
(test-assert-thrown 'system-error (config-load! (default-config-context) #:force-load #t))
;; Clean up.
test-skip() in srfi-64 should aid just in such cases. IIUC, it also reports what was skipped. Please follow the link to see more info on the function.
ccache dir.