paulfloyd / freebsd_valgrind

Git repo used to Upstream the FreeBSD Port of Valgrind
GNU General Public License v2.0
15 stars 4 forks source link

none/tests/rlimit_nofile makes unnecessary accommodation for number of files already opened [FreeBSD] #77

Closed nbriggs closed 4 years ago

nbriggs commented 4 years ago

With current test:

--- rlimit_nofile.stderr.exp    2020-04-11 12:53:56.960776000 -0700
+++ rlimit_nofile.stderr.out    2020-05-07 16:03:19.831365000 -0700
@@ -1,2 +1,3 @@

+open succeeded with fd 13399 - it should have failed!

Apply this change:

$ git diff
diff --git a/none/tests/rlimit_nofile.c b/none/tests/rlimit_nofile.c
index a6204125f..4410c3e48 100644
--- a/none/tests/rlimit_nofile.c
+++ b/none/tests/rlimit_nofile.c
@@ -91,12 +91,7 @@ int main(int argc, char **argv)
               (unsigned long long)oldrlim.rlim_max);
    }

-#if defined(VGO_freebsd)
-   // less than rather than equal to?
-   newrlim.rlim_cur -= 4;
-#else
    newrlim.rlim_cur -= 3; /* allow for stdin, stdout and stderr */
-#endif

    while (newrlim.rlim_cur-- > 0)
    {
$ 

and:

$ perl tests/vg_regtest none/tests/rlimit_nofile
rlimit_nofile:   valgrind   ./rlimit_nofile 

== 1 test, 0 stderr failures, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures ==

$ 
paulfloyd commented 4 years ago

I'm not sure what the default file descriptors are, but it seems as though the difference of 1 only applies on amd64. I changed the macro and it now passes on both x86 and amd64.