Closed usagi closed 9 years ago
I got the cause and the answer for the issue.
I was injected the debugging code into the test code:
FILE* f = fopen("/tmp/log", "w");
fprintf(f, "%s\n", executable_path);
fprintf(f, "%s\n", path);
fprintf(f, "%s\n", buffer);
fclose(f);
I got the result with ./autogen && ./configure && make && make check
:
/home/usagi/repos/libuv/test/.libs/lt-run-tests
/home/usagi/repos/libuv/test/.libs/lt-run-tests
/home/usagi/Dropbox/repos/libuv/test/.libs/lt-run-tests
And, ./gyp_uv.py -f make && make -C out && ./out/Debug/run-tests
:
./out/Debug/run-tests
out/Debug/run-tests
/home/usagi/Dropbox/repos/libuv/out/Debug/run-tests
The cause is current implement of executable_path
. executable_path
is not support symlinks. "/home/usagi/repos" in my environment is symlink, it is link to "Dropbox/repos".
Then, I propose a fixup to the test code test-get-currentexe.c
:
The source of executable_path
change from argv[0]
to /proc/self/exe
in GNU/Linux or /proc/curproc/file
in BSD(and Darwin) and read it with support symlink resolver as readlink
by unistd.h
. But, I don't know how to solve in Windows.
Have somebody any more better idea? And about the solution in Windows.
I haven't looked into it, but your analysis suggests uv_exepath
doesn't support symlinks, which IIRC is not the case. Maybe the test needs to be relaxed?
current(1.0.0-rc2) symlink supporting | example | |
---|---|---|
path (argv[0] ) in get_currentexe.c |
no | /some-symlink-dir/some-executable |
uv_exepath in libuv API |
yes | /symlink-resolved-path/some-executable |
This leads to a failure in the test unexpected. (Assertion failed in test/test-get-currentexe.c on line 58: match && !strcmp(match, path)
)
Therefore, I think it should be change better how to get path
in the test case. The test need to be strict, use symlink resolved path
. So, I was propose, use readlink
and /proc/self/exe
instead of argv[0]
in the test case test-get-currentexe.c
.
Ah, I see what you mean. It's the runner which saves argv[0] as executable_path
. I'll see if we can relax the test. If you have a patch which fixes the test without modifying the runner it would be awesome :-)
OK, I'll write a patch later :)
Closing.continues in #1565
version: current HEAD a4f88760be1838603fe2eae89a651066cc42eedd environment: ubuntu-14.04/x86_64, g++-4.8.2
make
is succeeded, butmake check
is failed.But, it is succeeded use gyp.