chiark / gitweb /
tmpdir: fixes from testing
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 15 Jun 2012 00:39:04 +0000 (01:39 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 15 Jun 2012 00:39:04 +0000 (01:39 +0100)
runner/adt-run

index 0ce14d19397074ad8428a14cfd5e65e0d502226b..cd8245149c282d68f728d016757ff9982033c4a3 100755 (executable)
@@ -1154,23 +1154,26 @@ class Test:
        if rc: bomb('failed to chmod +x %s' % tf)
 
        testtmp = '%s%s-testtmp' % (testbed.scratch.read(True), t.what)
-       script = 'rm -rf -- "$@"; mkdir -- "$@"'
+
+       script = 'buildtree="$1"; shift\n'
+       script += 'rm -rf -- "$@"; mkdir -- "$@"\n'
 
        if 'needs-root' not in t.restriction_names and opts.user is not None:
                tfl = ['su',opts.user,'-c',tf]
                if opts.user:
-                       script += '; chown %s "$@"' % opts.user
+                       script += 'chown %s "$@"\n' % opts.user
                        if 'rw-build-tree' in t.restriction_names:
-                               script += '; chown -R %s "$2"' % opts.user
+                               script += ('chown -R %s "$buildtree"\n'
+                                                % opts.user)
        else:
                tfl = [tf]
 
        test_tmpdir = testtmp+'/tmpdir'; xenv.append('TMPDIR=%s' % test_tmpdir)
-       test_addtmp = testtmp+'/addtmp'; xenv.append('ADTTMP=%s' % test_adttmp)
+       test_adttmp = testtmp+'/adttmp'; xenv.append('ADTTMP=%s' % test_adttmp)
        rc = testbed.execute('mktmpdir-'+t.what,
-               ['sh','-xec',script,'x',
-                       test_tmpdir, test_adttmp, 
-                       tree.read(True)])
+               ['sh','-xec',script,'x', tree.read(True),
+                       testtmp, test_tmpdir, test_adttmp, 
+                       ])
        if rc: bomb("could not create test tmp dirs in `%s', exit code %d"
                        % (testtmp, rc))