[erlang-questions] Odd behaviour of code:priv_dir/1
Hugo Mills
hugo@REDACTED
Wed Feb 20 13:54:08 CET 2019
On Wed, Feb 20, 2019 at 11:38:09AM +0000, Magnus Henoch wrote:
> Code paths, most likely. Print the value of code:get_path() just before
> the error and see if it contains "/path/to/childe/ebin".
>
> IIRC, it is _not_ enough for the code path to contain "./ebin", even if
> this would point to the correct directory. The name of the application
> must be literally present in the directory name in the code path in
> order for code:priv_dir to find the application.
That was exactly it. It was checking out into a directory called
"childe_code", because that was the name of the pipeline I'd given
it. Shift the checkout one layer deeper, into "childe_code/childe/",
and it all works.
Thank you. I'd never have got that by myself.
Hugo.
> Regards,
> Magnus
>
> On 20/02/2019 10:59, Hugo Mills wrote:
> > Ping? Anyone got any ideas at all how to go about diagnosing this?
> >
> > Hugo.
> >
> > On Sun, Feb 17, 2019 at 06:47:56PM +0000, Hugo Mills wrote:
> >> I've been trying to set up a basic CI system for a few projects.
> >> The problem is, I'm consistently getting test failures when running
> >> tests through the CI, where those tests pass perfectly well on a
> >> manual run.
> >>
> >> The test failure is:
> >>
> >> === Ended at 2019-02-17 15:36:20
> >> === Location: [{filename,join,446},
> >> {stdlib_SUITE,run_suite,37},
> >> {test_server,ts_tc,1545},
> >> {test_server,run_test_case_eval1,1063},
> >> {test_server,run_test_case_eval,995}]
> >> === Reason: no function clause matching
> >> filename:join({error,bad_name},"stdlib") (filename.erl, line 446)
> >> in function stdlib_SUITE:run_suite/3 (test/stdlib_SUITE.erl, line 37)
> >> in call from test_server:ts_tc/3 (test_server.erl, line 1545)
> >> in call from test_server:run_test_case_eval1/6 (test_server.erl, line 1063)
> >> in call from test_server:run_test_case_eval/9 (test_server.erl, line 995)
> >>
> >>
> >> which comes from this line of code in my CT text fixture:
> >>
> >> BaseContext =
> >> #{"$module_path"
> >> => [filename:join(code:priv_dir(childe), "stdlib")],
> >> "$data_path"
> >> => [?config(data_dir, Conf)]},
> >>
> >> I can run this on my main dev machines ("make ct" -- I'm using
> >> erlang.mk) quite happily, and it passes the test. I can run it
> >> manually on the CI worker machine and it passes the test. If I run it
> >> through a CI system, it fails with the above error.
> >>
> >> There's clearly _something_ odd about the environment that the CI
> >> system is running in, but I'm damned if I can tell what it is. It's
> >> not specific to the CI system, either: I've seen this with Buildbot,
> >> yesterday, and now GoCD today.
> >>
> >> Why would code:priv_dir/1 be failing in the CI when it's working in
> >> an interactive shell?
> >>
> >> My dev machines are running 21.2.2 from Debian; the CI is running
> >> 21.2.5 from Erlang Solutions, but that's not the issue, because I can
> >> do a manual run on the CI box, and it works.
> >>
> >> Thanks for any ideas,
> >> Hugo.
> >>
> >
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
--
Hugo Mills | To an Englishman, 100 miles is a long way; to an
hugo@REDACTED carfax.org.uk | American, 100 years is a long time.
http://carfax.org.uk/ |
PGP: E2AB1DE4 | Earle Hitchner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190220/90b3a5c2/attachment.bin>
More information about the erlang-questions
mailing list