Changeset 970


Ignore:
Timestamp:
Aug 11, 2011, 11:00:15 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

tests: Add testing sync process access on a GUI thread.

Location:
tests/process
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • tests/process/child/child.c

    r924 r970  
    2727    int         n;
    2828    FILE        *fp;
    29     char        buffer[4096];
     29    char        buffer[6];
    3030
    3131#ifdef __OS2__
  • tests/process/process-sync/process-sync-test.cmd

    r925 r970  
    55'@echo n >> n'
    66
    7 do i = 1 to 100
    8   /* run */
    9   '@del bigfile.txt.out 1>nul 2>nul'
    10   'process-sync.exe write bigfile.txt'
    11   /* compare results */
    12   'comp bigfile.txt bigfile.txt.out < n'
    13   if (rc \= 0) then do
    14     say 'ERROR: rc = 'rc' (i = 'i')'
    15     signal done
    16   end
    17 end
     7n_cycles = 100
    188
    19 do i = 1 to 100
    20   /* run */
    21   '@del bigfile.txt.out 1>nul 2>nul'
    22   'process-sync.exe read_out bigfile.txt'
    23   /* compare results */
    24   'comp bigfile.txt bigfile.txt.out < n'
    25   if (rc \= 0) then do
    26     say 'ERROR: rc = 'rc' (i = 'i')'
    27     signal done
    28   end
    29 end
     9do j = 1 to 2
     10    if (j == 1) then gui = ''
     11    else gui = 'gui'
    3012
    31 do i = 1 to 100
    32   /* run */
    33   '@del bigfile.txt.err 1>nul 2>nul'
    34   'process-sync.exe read_err bigfile.txt'
    35   /* compare results */
    36   'comp bigfile.txt bigfile.txt.err < n'
    37   if (rc \= 0) then do
    38     say 'ERROR: rc = 'rc' (i = 'i')'
    39     signal done
    40   end
     13    do i = 1 to n_cycles
     14      /* run */
     15      '@del bigfile.txt.out 1>nul 2>nul'
     16      'process-sync.exe write bigfile.txt' gui
     17      /* compare results */
     18      'comp bigfile.txt bigfile.txt.out < n'
     19      if (rc \= 0) then do
     20        say 'ERROR: rc = 'rc' (i = 'i')'
     21        signal done
     22      end
     23    end
     24
     25    do i = 1 to n_cycles
     26      /* run */
     27      '@del bigfile.txt.out 1>nul 2>nul'
     28      'process-sync.exe read_out bigfile.txt' gui
     29      /* compare results */
     30      'comp bigfile.txt bigfile.txt.out < n'
     31      if (rc \= 0) then do
     32        say 'ERROR: rc = 'rc' (i = 'i')'
     33        signal done
     34      end
     35    end
     36
     37    do i = 1 to n_cycles
     38      /* run */
     39      '@del bigfile.txt.err 1>nul 2>nul'
     40      'process-sync.exe read_err bigfile.txt' gui
     41      /* compare results */
     42      'comp bigfile.txt bigfile.txt.err < n'
     43      if (rc \= 0) then do
     44        say 'ERROR: rc = 'rc' (i = 'i')'
     45        signal done
     46      end
     47    end
    4148end
    4249
  • tests/process/process-sync/process-sync.cpp

    r925 r970  
    88#include <QFile>
    99#include <QProcess>
     10
    1011
    1112int test_write(const QString &aFile)
     
    3132            {
    3233                //QByteArray ba = f.read (2048);
    33                 QByteArray ba = f.read (32768);
     34                //QByteArray ba = f.read (32768);
     35                QByteArray ba = f.read (65536);
    3436
    3537                p.write (ba);
     
    8082        if (p.waitForStarted())
    8183        {
    82             while (p.waitForReadyRead())
     84            while (p.waitForReadyRead())
    8385            {
    8486                QByteArray ba = p.read (p.bytesAvailable());
     
    210212int main( int argc, char *argv[] )
    211213{
    212     if (argc == 3)
    213     {
     214    if (argc >= 3)
     215    {
     216        QScopedPointer <QApplication> app;
     217        if (argc == 4 && qstrcmp (argv [3], "gui") == 0)
     218            app.reset (new QApplication (argc, argv));
     219         
    214220        if (qstrcmp (argv [1], "read_out") == 0)
    215221            return test_read (QLatin1String (argv [2]), false);
  • tests/process/process-sync/process-sync.pro

    r926 r970  
    22include(../$$DEPTH/common.pri)
    33
    4 QT = core
     4QT = core
    55
    66SOURCES = process-sync.cpp
Note: See TracChangeset for help on using the changeset viewer.