Bug #10096 Multi-threaded testfile execution is not supported by Mysql Testframework
Submitted: 22 Apr 2005 15:25 Modified: 15 May 2005 15:26
Reporter: Disha Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.4-beta OS:Windows (Windows XP (Professional))
Assigned to: Kent Boortz CPU Architecture:Any

[22 Apr 2005 15:25] Disha
Description:
When several threads are invoked to execute testfiles using a common mysql-test folder, some testfiles fail giving a "permission denied" error

How to repeat:
1.  Write a program in perl to create 10 different threads.

Code snippet:-

#Code starts here
use Thread; 

sub main();
sub fn_StartTest($$);

main();

sub main()
{
	@thrd=(1..10);
	for($id=1; $id<=10;$id++)
	{
		$thrd[$id] = new Thread(\&fn_StartTest, $clientip , $id); 
		$thrd[$id]->detach();
	}
}

#---------------------------------------------------------------------------------------------------------------
sub fn_StartTest($$)
{ 		
	my $client = shift;
	my $session = shift;
	my $g_filename = "";
	my $g_start = "";
	my $g_end = "";
	my $output_file = "";
	my $output = "";
	$count = 0;	
	
	while ($count <2)
	{
		$count++;
 		$g_filename = &fn_get_random_file();
		$g_start = &fn_get_TimeStamp();
		$output_file = $path_output.$count.'_'.$session.'_'.$g_filename.'_'.$g_start.'.txt';
		open(STDOUT, ">$output_file") || die "Can't redirect stdout";
		open(STDERR, ">&STDOUT") || die "Can't dup stdout";

		select(STDERR); $| = 1;         # make unbuffered
		select(STDOUT); $| = 1;         # make unbuffered

		$output = system("perl mysql-test-run.pl --force --extern --user=root --verbose --master_port=3306 $g_filename");
		
		close(STDOUT);
		close(STDERR);
	}
}
#Code ends here

  
 2.  On each thread call the mysql-test-run.pl file with a testfile name.

 3.  Redirect the screen output to different files.

 Expected Results: The screen output files should have logged the appropriate testfile as pass or fail.
    
 Actual Results:  The screen output files show errors saying :-

mysql-test-run: *** ERROR: can't redirect STDERR to "": Permission denied
mysql-test-run: *** ERROR: can't open file "c:/MySql/mysql-test/var/log/mysqltest-time": Permission denied

 Attachments:  1_9_50_views_401001x401010_032220052002239.txt
[22 Apr 2005 15:26] Disha
screen output file

Attachment: 1_9_50_views_401001x401010_032220052002239.txt (text/plain), 1.79 KiB.

[15 May 2005 15:24] Kent Boortz
The mysql-test platform was never designed to be run in parallel.
An option --vardir=<dir> was added that might enable this use,
i.e. you give each mysql-test-run.pl invocation a separate "var"
directory, like

  ./mysql-test-run --extern --vardir=var-1 .... &
  ./mysql-test-run --extern --vardir=var-2 .... &
  ./mysql-test-run --extern --vardir=var-3 .... &
  .
  .
[15 May 2005 15:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24907
[15 May 2005 15:26] Kent Boortz
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html