Re: [Mesa-dev] [PATCH] compiler/glsl: close fd's in glcpp_test.py

2018-04-21 Thread Vinson Lee
On Fri, Apr 20, 2018 at 10:22 AM, Dylan Baker  wrote:
> I would have thought falling out of scope would allow the gc to collect
> these, but apparently it doesn't, and this hits an fd limit on macos.
>
> CC: v...@freedesktop.org
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106133
> Fixes: db8cd8e36771eed98eb638fd0593c978c3da52a9
>("glcpp/tests: Convert shell scripts to a python script")
> Signed-off-by: Dylan Baker 
> ---
>  src/compiler/glsl/glcpp/tests/glcpp_test.py | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/glsl/glcpp/tests/glcpp_test.py 
> b/src/compiler/glsl/glcpp/tests/glcpp_test.py
> index f07c2414ea2..cdc63b3ac2a 100755
> --- a/src/compiler/glsl/glcpp/tests/glcpp_test.py
> +++ b/src/compiler/glsl/glcpp/tests/glcpp_test.py
> @@ -78,7 +78,8 @@ def _valgrind(glcpp, filename):
>  extra_args = parse_test_file(filename, nl_format='\n')
>
>  try:
> -_, tmpfile = tempfile.mkstemp()
> +fd, tmpfile = tempfile.mkstemp()
> +os.close(fd)
>  with open(filename, 'rb') as f:
>  proc = subprocess.Popen(
>  ['valgrind', '--error-exitcode=31', '--log-file', tmpfile, 
> glcpp] + extra_args,
> @@ -135,7 +136,8 @@ def _replace_test(args, replace):
>  total += 1
>  testfile = os.path.join(args.testdir, filename)
>  try:
> -_, tmpfile = tempfile.mkstemp()
> +fd, tmpfile = tempfile.mkstemp()
> +os.close(fd)
>  with io.open(testfile, 'rt') as f:
>  contents = f.read()
>  with io.open(tmpfile, 'wt') as f:
> --
> 2.17.0
>

Tested-by: Vinson Lee 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] compiler/glsl: close fd's in glcpp_test.py

2018-04-20 Thread Eric Anholt
Dylan Baker  writes:

> I would have thought falling out of scope would allow the gc to collect
> these, but apparently it doesn't, and this hits an fd limit on macos.

Reviewed-by: Eric Anholt 


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] compiler/glsl: close fd's in glcpp_test.py

2018-04-20 Thread Dylan Baker
I would have thought falling out of scope would allow the gc to collect
these, but apparently it doesn't, and this hits an fd limit on macos.

CC: v...@freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106133
Fixes: db8cd8e36771eed98eb638fd0593c978c3da52a9
   ("glcpp/tests: Convert shell scripts to a python script")
Signed-off-by: Dylan Baker 
---
 src/compiler/glsl/glcpp/tests/glcpp_test.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/glcpp/tests/glcpp_test.py 
b/src/compiler/glsl/glcpp/tests/glcpp_test.py
index f07c2414ea2..cdc63b3ac2a 100755
--- a/src/compiler/glsl/glcpp/tests/glcpp_test.py
+++ b/src/compiler/glsl/glcpp/tests/glcpp_test.py
@@ -78,7 +78,8 @@ def _valgrind(glcpp, filename):
 extra_args = parse_test_file(filename, nl_format='\n')
 
 try:
-_, tmpfile = tempfile.mkstemp()
+fd, tmpfile = tempfile.mkstemp()
+os.close(fd)
 with open(filename, 'rb') as f:
 proc = subprocess.Popen(
 ['valgrind', '--error-exitcode=31', '--log-file', tmpfile, 
glcpp] + extra_args,
@@ -135,7 +136,8 @@ def _replace_test(args, replace):
 total += 1
 testfile = os.path.join(args.testdir, filename)
 try:
-_, tmpfile = tempfile.mkstemp()
+fd, tmpfile = tempfile.mkstemp()
+os.close(fd)
 with io.open(testfile, 'rt') as f:
 contents = f.read()
 with io.open(tmpfile, 'wt') as f:
-- 
2.17.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev