]> lifelog.hopto.org Git - PerlCNF.git/commitdiff
.
authorWill Budic <redacted>
Thu, 23 Oct 2025 08:28:46 +0000 (19:28 +1100)
committerWill Budic <redacted>
Thu, 23 Oct 2025 08:28:46 +0000 (19:28 +1100)
tests/testSQLPostgres_on_elite.pl
tests/test_Threads.pl

index 407c07e32cde7667e3a303570ca687526feeede8..2b1fd949795fb8cdbbdcef807acd46ef082a74f7 100644 (file)
@@ -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
  **/
 <<<FILE $0>>>
-
-
 );
 
 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
 <<selLongest5CMDs<SQL>
 SELECT *, LENGTH("CMD") as len FROM public.cmd_history
 ORDER BY len DESC LIMIT 5;
->>
\ No newline at end of file
+>>
index 70f5349daae7d38700a8fda9d9e75908414f6b68..0e690af90fa19473208ce94dae4b41eb0fa090e9 100644 (file)
@@ -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];
 }