[erlang-questions] Odd behaviour of code:priv_dir/1

Magnus Henoch magnus@REDACTED
Wed Feb 20 12:38:09 CET 2019

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.


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190220/afe97525/attachment.htm>

More information about the erlang-questions mailing list