Testsuite threadsafety

Hi *, I’m trying to understand a few pieces of code in the testsuite, As it so happens quite a few tests randomly fail on newer msys2 and python installs: r:/temp/ghctest-0u4c8o/test spaces/./th/T12407.run T12407 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T12407.run') r:/temp/ghctest-0u4c8o/test spaces/./th/T11463.run T11463 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T11463.run') r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_4.run T12478_4 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_4.run') r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_3.run T12478_3 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_3.run') (I say random, but the set of tests seem to be the same ones, just within that group a few randomly pass every so often. It’s mostly TH tests.) Anyone have any ideas? I’m not very familiar with the internals of the testsuite. Secondly, I’ve noticed all paths in the testsuite are relative paths. And this hand me wondering, relative to what. I see that in do_test we actually change directories 837 if opts.pre_cmd: 838 exit_code = runCmd('cd "{0}" && {1}'.format(opts.testdir, opts.pre_cmd)) So I am now assuming that the relative paths are relative to the cwd. Which brings up the question.. how is this thread safe and working on Linux? Surely any two tests can change the cwd and then one of them would be writing to the wrong place? Am I missing something here? Cheers, Tamar

lonetiger@gmail.com writes:
Hi *,
I’m trying to understand a few pieces of code in the testsuite,
As it so happens quite a few tests randomly fail on newer msys2 and python installs:
r:/temp/ghctest-0u4c8o/test spaces/./th/T12407.run T12407 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T12407.run') r:/temp/ghctest-0u4c8o/test spaces/./th/T11463.run T11463 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T11463.run') r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_4.run T12478_4 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_4.run') r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_3.run T12478_3 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_3.run')
(I say random, but the set of tests seem to be the same ones, just within that group a few randomly pass every so often. It’s mostly TH tests.)
Anyone have any ideas? I’m not very familiar with the internals of the testsuite.
Secondly, I’ve noticed all paths in the testsuite are relative paths. And this hand me wondering, relative to what.
I see that in do_test we actually change directories
837 if opts.pre_cmd: 838 exit_code = runCmd('cd "{0}" && {1}'.format(opts.testdir, opts.pre_cmd))
If I understand this correctly, this is merely spawning off a child shell process which then moves its own cwd to opts.testdir. This should not affect the cwd of the testsuite driver, which means that it should be perfectly safe. Cheers, - Ben

Thanks! Had missed the spawning of a new process part. From: Ben Gamari Sent: Saturday, October 15, 2016 00:12 To: lonetiger@gmail.com; ghc-devs@haskell.org Subject: Re: Testsuite threadsafety lonetiger@gmail.com writes:
Hi *,
I’m trying to understand a few pieces of code in the testsuite,
As it so happens quite a few tests randomly fail on newer msys2 and python installs:
r:/temp/ghctest-0u4c8o/test spaces/./th/T12407.run T12407 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T12407.run') r:/temp/ghctest-0u4c8o/test spaces/./th/T11463.run T11463 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T11463.run') r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_4.run T12478_4 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_4.run') r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_3.run T12478_3 [ext-interp] ([Error 183] Cannot create a file when that file already exists: 'r:/temp/ghctest-0u4c8o/test spaces/./th/T12478_3.run')
(I say random, but the set of tests seem to be the same ones, just within that group a few randomly pass every so often. It’s mostly TH tests.)
Anyone have any ideas? I’m not very familiar with the internals of the testsuite.
Secondly, I’ve noticed all paths in the testsuite are relative paths. And this hand me wondering, relative to what.
I see that in do_test we actually change directories
837 if opts.pre_cmd: 838 exit_code = runCmd('cd "{0}" && {1}'.format(opts.testdir, opts.pre_cmd))
If I understand this correctly, this is merely spawning off a child shell process which then moves its own cwd to opts.testdir. This should not affect the cwd of the testsuite driver, which means that it should be perfectly safe. Cheers, - Ben
participants (2)
-
Ben Gamari
-
lonetiger@gmail.com