From: Dyre Tjeldvoll Date: November 9 2012 9:19am Subject: bzr push into mysql-5.5-cluster-7.2 branch (Dyre.Tjeldvoll:4104 to 4105) List-Archive: http://lists.mysql.com/commits/145206 Message-Id: <20121109091942.25706.13675.4105@khepri17.no.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4105 Dyre Tjeldvoll 2012-11-09 Allow python interpreter to be passed to mtr test in env variable and modify unit tests to use MYSQL_TMP_DIR when available modified: mysql-test/suite/ndb/t/mcc_pyunit.test storage/ndb/mcc/tst/tst_main.py 4104 Dyre Tjeldvoll 2012-11-07 Wrong comment syntax in prev push modified: mysql-test/collections/mysql-5.5-cluster-7.2-mcc.push === modified file 'mysql-test/suite/ndb/t/mcc_pyunit.test' --- a/mysql-test/suite/ndb/t/mcc_pyunit.test 2012-11-05 11:42:43 +0000 +++ b/mysql-test/suite/ndb/t/mcc_pyunit.test 2012-11-09 09:19:01 +0000 @@ -1,6 +1,7 @@ --perl use strict; +warn `env`; my $tstdir = "../storage/ndb/mcc/tst"; # Assume source package layout first... then try install/package layout unless (-f "$tstdir/tst_main.py") { @@ -13,7 +14,9 @@ warn "tst_main.py found in: $tstdir"; chdir($tstdir); warn `pwd`; -my $exit_code = system("python", "tst_main.py")/256; +my $python = $ENV{'MCC_PYTHON'}; +unless ($python) { $python = "python"; } +my $exit_code = system($python, "tst_main.py")/256; if ($exit_code == 0) { print "Python unit tests: Success\n"; === modified file 'storage/ndb/mcc/tst/tst_main.py' --- a/storage/ndb/mcc/tst/tst_main.py 2012-11-05 11:42:43 +0000 +++ b/storage/ndb/mcc/tst/tst_main.py 2012-11-09 09:19:01 +0000 @@ -54,6 +54,10 @@ from remote_clusterhost import RemoteClu from paramiko import SSHClient, WarningPolicy +def tst_tempify(*fs): + return os.path.join(util.get_val(os.environ, 'MYSQL_TMP_DIR', + tempfile.gettempdir()), *fs) + def defdatadir(): return os.path.join(os.path.expanduser('~'), 'MySQL_Cluster', 'data') @@ -172,28 +176,29 @@ class _TestABClusterHost: self.assertEqual(self.ch.exec_blocking(['echo', 'foo']).strip(), 'foo') def test_fileops(self): - self.assertTrue(self.ch.file_exists('/tmp')) - self.ch.mkdir_p('/tmp/foo/bar//') + self.ch.mkdir_p(tst_tempify('foo', 'bar', '')) f = None try: - f = self.ch.open('/tmp/foo/bar/baz', 'w+') + f = self.ch.open(tst_tempify('foo', 'bar', 'baz'), 'w+') f.write('Some text here...\n') f.seek(0) self.assertEqual(f.read(), 'Some text here...\n') finally: if f is not None: f.close() - self.ch.rm_r('/tmp/foo') + self.ch.rm_r(tst_tempify('foo')) def test_stat_dir_2(self): if not hasattr(self.ch, 'sftp'): return - self.assertTrue(stat.S_ISDIR(self.ch.sftp.stat('/tmp').st_mode)) + self.assertTrue(stat.S_ISDIR(self.ch.sftp.stat(tst_tempify('')).st_mode)) @utmod.skip('Cannot create files with attributes') def test_list_dir_no_x(self): - nox_mode = self.self.ch.sftp.stat('/tmp/nox').st_mode - notmine_mode = self.self.ch.sftp.stat('/tmp/not_mine').st_mode + nox_name = tst_tempify('nox') + notmine_name = tst_tempify('not_mine') + nox_mode = self.self.ch.sftp.stat(nox_name).st_mode + notmine_mode = self.self.ch.sftp.stat(notmine_name).st_mode self.assertTrue(stat.S_ISDIR(nox_mode)) self.assertTrue(is_set(stat.S_IMODE(nox_mode), stat.S_IXGRP)) @@ -201,12 +206,13 @@ class _TestABClusterHost: self.assertTrue(stat.S_ISDIR(notmine_mode)) self.assertTrue(is_set(stat.S_IMODE(notmine_mode), stat.S_IXOTH)) - print "listdir(nox)="+str(self.self.ch.list_dir('/tmp/nox')) - print "listdir(notmine)="+str(self.self.ch.list_dir('/tmp/not_mine')) + print "listdir(nox)="+str(self.self.ch.list_dir(nox_name)) + print "listdir(notmine)="+str(self.self.ch.list_dir(notmine_name)) def test_mkdir_p(self): - self.ch.mkdir_p('/tmp/some_dir/') - self.ch.rm_r('/tmp/some_dir/') + somedir_name = tst_tempify('some_dir') + self.ch.mkdir_p(somedir_name) + self.ch.rm_r(somedir_name) def test_hostInfo(self): hir = json_normalize(self.ch.hostInfo.rep) @@ -238,10 +244,14 @@ class Test5RemoteClusterHost(utmod.TestC if not hasattr(self.ch, 'sftp'): return ex.seek(0) - self.ch.sftp.put(ex.name, '/tmp/example.txt') - self.ch.sftp.get('/tmp/example.txt', 'remote_example.txt') - with open('remote_example.txt') as rex: - self.assertEqual(ex.read(), rex.read()) + tmpex_name = tst_tempify('example.txt') + self.ch.sftp.put(ex.name, tmpex_name) + try: + self.ch.sftp.get(tmpex_name, 'remote_example.txt') + with open('remote_example.txt') as rex: + self.assertEqual(ex.read(), rex.read()) + finally: + self.ch.sftp.remove(tmpex_name) def test_mkdir(self): with tempfile.NamedTemporaryFile() as ex: @@ -249,17 +259,19 @@ class Test5RemoteClusterHost(utmod.TestC ex.seek(0) if not hasattr(self.ch, 'sftp'): return - self.ch.sftp.mkdir('/tmp/some_new_dir/') + some_new_dir_name = tst_tempify('some_new_dir') + self.ch.sftp.mkdir(some_new_dir_name) + tmpex_name = os.path.join(some_new_dir_name, 'example.txt') try: - self.ch.sftp.put(ex.name, '/tmp/some_new_dir/example.txt') - self.ch.sftp.remove('/tmp/some_new_dir/example.txt') + self.ch.sftp.put(ex.name, tmpex_name) + self.ch.sftp.remove(tmpex_name) finally: - self.ch.sftp.rmdir('/tmp/some_new_dir/') + self.ch.sftp.rmdir(some_new_dir_name) def test_stat_dir(self): if not hasattr(self.ch, 'sftp'): return - self.assertEqual(stat.S_IFMT(self.ch.sftp.stat('/tmp').st_mode), stat.S_IFDIR) + self.assertEqual(stat.S_IFMT(self.ch.sftp.stat(tst_tempify('')).st_mode), stat.S_IFDIR) class Test6RequestHandler(utmod.TestCase): No bundle (reason: useless for push emails).