From: Will Budic Date: Thu, 23 Oct 2025 08:28:46 +0000 (+1100) Subject: . X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=b36d1da654d466d1b544b0a819c0956268aec9a3;p=PerlCNF.git . --- diff --git a/tests/testSQLPostgres_on_elite.pl b/tests/testSQLPostgres_on_elite.pl index 407c07e..2b1fd94 100644 --- a/tests/testSQLPostgres_on_elite.pl +++ b/tests/testSQLPostgres_on_elite.pl @@ -1,4 +1,5 @@ #!/usr/bin/env perl +use 5.28.0; use warnings; use strict; use Syntax::Keyword::Try; use Benchmark; @@ -22,8 +23,6 @@ my $DB_SETTINGS = q( * Load and ~/.config/this_script_name.cnf **/ <<>> - - ); try{ @@ -168,7 +167,7 @@ There is: $stSelHistCNT_CMD->execute($next[0], $next[1]); my @r = $stSelHistCNT_CMD->fetchrow_array(); if(@r){ - print "Has entry[$next[1]]:".CNFSQL::_decodeQuotes($next[0]) + say "Has entry[$next[1]]:".CNFSQL::_decodeQuotes($next[0]) }else{ $stSelHistCMD ->execute($next[1]); @r = $stSelHistCMD->fetchrow_array(); @@ -187,10 +186,9 @@ There is: print "\nID`\tDATE`\t Command\t `Count`Host`LenOfCMD~\n"; while (my @next=$pstRows->fetchrow_array()){ $selects++; - print $cnf->SQL()->CNFSQL::_decodeQuotes( join("` ", @next)),"~\n" + print CNFSQL::_decodeQuotes( join("` ", @next)),"~\n" } $test->evaluate("5==\$selects",5,$selects); - $test # $test->done(); # @@ -287,4 +285,4 @@ UPDATE public.cmd_history < SELECT *, LENGTH("CMD") as len FROM public.cmd_history ORDER BY len DESC LIMIT 5; ->> \ No newline at end of file +>> diff --git a/tests/test_Threads.pl b/tests/test_Threads.pl index 70f5349..0e690af 100644 --- a/tests/test_Threads.pl +++ b/tests/test_Threads.pl @@ -11,12 +11,8 @@ use lib "local"; use Config; $Config{useithreads} or die('Recompile Perl with threads to run this program.'); - use lib::relative "../system/modules"; require CNFParser; - -# use lib "system/modules"; - require TestManager; my $test = TestManager->new($0)->unsuited(); my $cnf; @@ -29,46 +25,48 @@ use threads ('yield', use threads::shared; our $global :shared = 1; - try { + if ( not $cnf = CNFParser->blank( { DEBUG => 1 } ) ) { $test->failed("new instance"); } else { $test->passed("Passed new instance CNFParser."); - } - - - + } - my $thr = threads->create('sub1', 'argument'); + my $thr = threads->create('sub1', 'argument'); + if ( $thr->is_running() ) { + sleep(1); + print "Thread $thr running!\n"; + } + else { + print "Not running\n"; + } my $result1 = threads->create(sub { my $foo = 50; sleep(.5); - while ( $foo-- ) {print "first async\n"; yield(); lock($global); $global--; } + while ( $foo-- ) { #print "first async\n"; + yield(); lock($global); $global--; } yield(); $foo = 150; - while ( $foo-- ) { print "first async2\n"; yield()} + while ( $foo-- ) { #print "first async2\n"; + yield()} return [$global]; }); my $result2 = async { lock($global); my $foo = 50; sleep(.5); - while ( $foo-- ) { print "second async\n"; $global++; yield()} + while ( $foo-- ) { #print "second async\n"; + $global++; yield()} yield(); $foo = 50; - while ( $foo-- ) { print "second async2\n" } + while ( $foo-- ) { #print "second async2\n" + } return [$global]; }; - if ( $thr->is_running() ) { - sleep(1); - print "Thread $thr running!\n"; - } - else { - print "Not running\n"; - } + sleep(2); @@ -82,6 +80,9 @@ try { print "Thread2 returned [". join (",", @$result2)."]\n"; print "Thread3 returned [". join (",", @$result3)."]\n"; + + + # $test->done(); # @@ -103,7 +104,8 @@ sub sub1 { lock($global); $glob = $global } - while ( $foo-- ) { print "sub1\n"; $global++; yield();sleep(.5)} + while ( $foo-- ) { #print "sub1\n"; + $global++; yield();sleep(.5)} return ["sub1", $glob, $global]; }