Changeset 481f882 for tests


Ignore:
Timestamp:
Oct 12, 2022, 4:32:49 PM (22 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master
Children:
38cc59f
Parents:
a51b8f6
Message:

Added some missing headers and cleaned up some of the fork+exec stuff.

Location:
tests
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • tests/configs/.expect/parsebools.txt

    ra51b8f6 r481f882  
    77set false  :true
    88Child status:
    9     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     9IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    1010
    1111all true/set arg:
     
    1717set false  :false
    1818Child status:
    19     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     19IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    2020
    2121all false/unset arg:
     
    2727set false  :true
    2828Child status:
    29     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     29IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    3030
    3131gibberish arg 1:
     
    4343  -h, --help        print this help message
    4444Child status:
    45     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     45IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    4646
    4747gibberish arg 2:
     
    5959  -h, --help        print this help message
    6060Child status:
    61     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     61IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    6262
    6363gibberish arg 3:
     
    7474  -h, --help        print this help message
    7575Child status:
    76     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     76IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    7777
    7878gibberish arg 4:
     
    8989  -h, --help        print this help message
    9090Child status:
    91     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     91IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    9292
    9393All Done!
  • tests/configs/.expect/parsenums.x64.txt

    ra51b8f6 r481f882  
    66double             :3.3
    77Child status:
    8     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     8IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    99
    1010all 0 arg:
     
    1515double             :0.
    1616Child status:
    17     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     17IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    1818
    1919negative vals arg:
     
    2424double             :-1.
    2525Child status:
    26     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     26IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    2727
    2828funky notation arg:
     
    3333double             :5000000.
    3434Child status:
    35     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     35IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    3636
    3737big values arg:
     
    4242double             :5000000.
    4343Child status:
    44     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     44IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    4545
    4646too big values arg:
     
    5757  -h, --help               print this help message
    5858Child status:
    59     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     59IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    6060
    6161Argument '4294967296' for option u could not be parsed
     
    7171  -h, --help               print this help message
    7272Child status:
    73     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     73IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    7474
    7575Argument '18446744073709551616' for option l could not be parsed
     
    8585  -h, --help               print this help message
    8686Child status:
    87     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     87IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    8888
    8989Argument '18446744073709551616' for option L could not be parsed
     
    9999  -h, --help               print this help message
    100100Child status:
    101     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     101IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    102102
    103103negative errors arg:
     
    114114  -h, --help               print this help message
    115115Child status:
    116     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     116IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    117117
    118118Argument '-1' for option l could not be parsed
     
    128128  -h, --help               print this help message
    129129Child status:
    130     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     130IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    131131
    132132Argument '-1' for option L could not be parsed
     
    142142  -h, --help               print this help message
    143143Child status:
    144     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     144IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    145145
    146146All Done!
  • tests/configs/.expect/parsenums.x86.txt

    ra51b8f6 r481f882  
    66double             :3.3
    77Child status:
    8     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     8IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    99
    1010all 0 arg:
     
    1515double             :0.
    1616Child status:
    17     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     17IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    1818
    1919negative vals arg:
     
    2424double             :-1.
    2525Child status:
    26     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     26IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    2727
    2828funky notation arg:
     
    3333double             :5000000.
    3434Child status:
    35     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     35IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    3636
    3737big values arg:
     
    4242double             :5000000.
    4343Child status:
    44     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     44IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
    4545
    4646too big values arg:
     
    5757  -h, --help               print this help message
    5858Child status:
    59     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     59IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    6060
    6161Argument '4294967296' for option u could not be parsed
     
    7171  -h, --help               print this help message
    7272Child status:
    73     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     73IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    7474
    7575Argument '4294967296' for option l could not be parsed
     
    8585  -h, --help               print this help message
    8686Child status:
    87     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     87IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    8888
    8989Argument '18446744073709551616' for option L could not be parsed
     
    9999  -h, --help               print this help message
    100100Child status:
    101     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     101IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    102102
    103103negative errors arg:
     
    114114  -h, --help               print this help message
    115115Child status:
    116     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     116IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    117117
    118118Argument '-1' for option l could not be parsed
     
    128128  -h, --help               print this help message
    129129Child status:
    130     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     130IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    131131
    132132Argument '-1' for option L could not be parsed
     
    142142  -h, --help               print this help message
    143143Child status:
    144     WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
     144IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
    145145
    146146All Done!
  • tests/configs/parsebools.cfa

    ra51b8f6 r481f882  
    1 #include <stdlib.h>
    2 #include <stdio.h>
    3 #include <string.h>
    4 
    5 #include <errno.h>
    6 #include <signal.h>
    7 
    8 extern "C" {
    9         #include <sys/types.h>
    10         #include <sys/wait.h>
    11         #include <unistd.h>
    12 }
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2022 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// configs/parsebools.cfa
     8// Testing parsing of boolean arguments
     9//
     10// Author           : Thierry Delisle
     11// Created On       : Wed Oct 12 15:28:01 2022
     12// Last Modified By :
     13// Last Modified On :
     14// Update Count     :
     15//
    1316
    1417#include <parseargs.hfa>
    1518#include <fstream.hfa>
    1619
    17 int true_main(const char * exec);
     20#include "../meta/fork+exec.hfa"
    1821
    1922int main(int argc, char * argv[]) {
    20         if(!getenv("CFATEST_FORK_EXEC_TEXT")) return true_main(argv[0]);
     23        check_main(argv[0]);
    2124
    2225        bool YN = false;
     
    4851}
    4952
    50 int do_wait(pid_t pid) {
    51         int wstatus;
    52         int options = 0;
    53         pid_t ret = waitpid(pid, &wstatus, options);
    54         fflush(stdout);
    55         if(ret < 0) {
    56                 fprintf(stderr, "Fork returned with error: %d '%s'\n", errno, strerror(errno));
    57                 exit(1);
    58         }
    59         return wstatus;
    60 }
    61 
    62 pid_t strict_fork(void) {
    63         fflush(stdout);
    64         pid_t ret = fork();
    65         if(ret < 0) {
    66                 fprintf(stderr, "Fork returned with error: %d '%s'\n", errno, strerror(errno));
    67                 exit(1);
    68         }
    69         return ret;
    70 }
    71 
    72 void print_status(int wstatus) {
    73         printf("Child status:\n");
    74         printf("    WIFEXITED   : %d", WIFEXITED(wstatus));
    75         printf("    WEXITSTATUS : %d", WEXITSTATUS(wstatus));
    76         printf("    WIFSIGNALED : %d", WIFSIGNALED(wstatus));
    77         printf("    WTERMSIG    : %d", WTERMSIG(wstatus));
    78         printf("    WCOREDUMP   : %d", WCOREDUMP(wstatus));
    79         printf("    WIFSTOPPED  : %d", WIFSTOPPED(wstatus));
    80         printf("    WSTOPSIG    : %d", WSTOPSIG(wstatus));
    81         printf("    WIFCONTINUED: %d\n", WIFCONTINUED(wstatus));
    82 }
    83 
    84 int true_main(const char * path) {
    85         char * env[] = { "CFATEST_FORK_EXEC_TEXT=1", 0p };
    86 
     53int true_main(const char * path, char * env[]) {
    8754        printf("no arg:\n");
    8855        if(pid_t child = strict_fork(); child == 0) {
     
    9764                print_status(status);
    9865        }
    99         printf("\n");
    10066
    10167        printf("all true/set arg:\n");
     
    11177                print_status(status);
    11278        }
    113         printf("\n");
    11479
    11580        printf("all false/unset arg:\n");
     
    12590                print_status(status);
    12691        }
    127         printf("\n");
    12892
    12993        printf("gibberish arg 1:\n");
     
    139103                print_status(status);
    140104        }
    141         printf("\n");
    142105
    143106        printf("gibberish arg 2:\n");
     
    153116                print_status(status);
    154117        }
    155         printf("\n");
    156118
    157119        printf("gibberish arg 3:\n");
     
    167129                print_status(status);
    168130        }
    169         printf("\n");
    170131
    171132        printf("gibberish arg 4:\n");
     
    181142                print_status(status);
    182143        }
    183         printf("\n");
    184144
    185145        printf("All Done!\n");
  • tests/configs/parsenums.cfa

    ra51b8f6 r481f882  
    1 #include <stdlib.h>
    2 #include <stdio.h>
    3 #include <string.h>
    4 
    5 #include <errno.h>
    6 #include <signal.h>
    7 
    8 extern "C" {
    9         #include <sys/types.h>
    10         #include <sys/wait.h>
    11         #include <unistd.h>
    12 }
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2022 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// configs/parsenums.cfa
     8// Testing parsing of integer arguments
     9//
     10// Author           : Thierry Delisle
     11// Created On       : Wed Oct 12 15:28:01 2022
     12// Last Modified By :
     13// Last Modified On :
     14// Update Count     :
     15//
    1316
    1417#include <parseargs.hfa>
    1518#include <fstream.hfa>
     19
     20#include "../meta/fork+exec.hfa"
    1621
    1722#if __SIZEOF_LONG__ == 4
     
    2833
    2934int main(int argc, char * argv[]) {
    30         if(!getenv("CFATEST_FORK_EXEC_TEXT")) return true_main(argv[0]);
     35        check_main(argv[0]);
    3136
    3237        int i = -3;
     
    5661}
    5762
    58 int do_wait(pid_t pid) {
    59         int wstatus;
    60         int options = 0;
    61         pid_t ret = waitpid(pid, &wstatus, options);
    62         fflush(stdout);
    63         if(ret < 0) {
    64                 fprintf(stderr, "Fork returned with error: %d '%s'\n", errno, strerror(errno));
    65                 exit(1);
    66         }
    67         return wstatus;
    68 }
    69 
    70 pid_t strict_fork(void) {
    71         fflush(stdout);
    72         pid_t ret = fork();
    73         if(ret < 0) {
    74                 fprintf(stderr, "Fork returned with error: %d '%s'\n", errno, strerror(errno));
    75                 exit(1);
    76         }
    77         return ret;
    78 }
    79 
    80 void print_status(int wstatus) {
    81         printf("Child status:\n");
    82         printf("    WIFEXITED   : %d", WIFEXITED(wstatus));
    83         printf("    WEXITSTATUS : %d", WEXITSTATUS(wstatus));
    84         printf("    WIFSIGNALED : %d", WIFSIGNALED(wstatus));
    85         printf("    WTERMSIG    : %d", WTERMSIG(wstatus));
    86         printf("    WCOREDUMP   : %d", WCOREDUMP(wstatus));
    87         printf("    WIFSTOPPED  : %d", WIFSTOPPED(wstatus));
    88         printf("    WSTOPSIG    : %d", WSTOPSIG(wstatus));
    89         printf("    WIFCONTINUED: %d\n", WIFCONTINUED(wstatus));
    90 }
    91 
    92 int true_main(const char * path) {
    93         char * env[] = { "CFATEST_FORK_EXEC_TEXT=1", 0p };
    94 
     63int true_main(const char * path, char * env[]) {
    9564        printf("no arg:\n");
    9665        if(pid_t child = strict_fork(); child == 0) {
     
    10574                print_status(status);
    10675        }
    107         printf("\n");
    10876
    10977        printf("all 0 arg:\n");
     
    11987                print_status(status);
    12088        }
    121         printf("\n");
    12289
    12390        printf("negative vals arg:\n");
     
    133100                print_status(status);
    134101        }
    135         printf("\n");
    136102
    137103        printf("funky notation arg:\n");
     
    147113                print_status(status);
    148114        }
    149         printf("\n");
    150115
    151116        printf("big values arg:\n");
     
    161126                print_status(status);
    162127        }
    163         printf("\n");
    164128
    165129        printf("too big values arg:\n");
     
    175139                print_status(status);
    176140        }
    177         printf("\n");
    178141
    179142        if(pid_t child = strict_fork(); child == 0) {
     
    188151                print_status(status);
    189152        }
    190         printf("\n");
    191153
    192154        if(pid_t child = strict_fork(); child == 0) {
     
    201163                print_status(status);
    202164        }
    203         printf("\n");
    204165
    205166        if(pid_t child = strict_fork(); child == 0) {
     
    214175                print_status(status);
    215176        }
    216         printf("\n");
    217177
    218178        printf("negative errors arg:\n");
     
    228188                print_status(status);
    229189        }
    230         printf("\n");
    231190
    232191        if(pid_t child = strict_fork(); child == 0) {
     
    241200                print_status(status);
    242201        }
    243         printf("\n");
    244202
    245203        if(pid_t child = strict_fork(); child == 0) {
     
    254212                print_status(status);
    255213        }
    256         printf("\n");
    257214
    258215        printf("All Done!\n");
  • tests/meta/.expect/fork+exec.txt

    ra51b8f6 r481f882  
    44Success!
    55Child status:
    6     WIFEXITED   : 1
    7     WEXITSTATUS : 0
    8     WIFSIGNALED : 0
    9     WTERMSIG    : 0
    10     WCOREDUMP   : 0
    11     WIFSTOPPED  : 0
    12     WSTOPSIG    : 0
    13     WIFCONTINUED: 0
     6IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
     7
    1481 arg:
    159arguments are:
     
    1711Success!
    1812Child status:
    19     WIFEXITED   : 1
    20     WEXITSTATUS : 0
    21     WIFSIGNALED : 0
    22     WTERMSIG    : 0
    23     WCOREDUMP   : 0
    24     WIFSTOPPED  : 0
    25     WSTOPSIG    : 0
    26     WIFCONTINUED: 0
     13IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
     14
    27155 arg:
    2816arguments are:
     
    3422Success!
    3523Child status:
    36     WIFEXITED   : 1
    37     WEXITSTATUS : 0
    38     WIFSIGNALED : 0
    39     WTERMSIG    : 0
    40     WCOREDUMP   : 0
    41     WIFSTOPPED  : 0
    42     WSTOPSIG    : 0
    43     WIFCONTINUED: 0
     24IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
     25
    4426All Done!
  • tests/meta/fork+exec.hfa

    ra51b8f6 r481f882  
    2828}
    2929
    30 static int true_main(const char * exec, char * env[]);
     30static int true_main(const char * path, char * env[]);
    3131
    3232static int do_wait(pid_t pid) {
     
    5555static void print_status(int wstatus) {
    5656        printf("Child status:\n");
    57         printf("    WIFEXITED   : %d\n", WIFEXITED(wstatus));
    58         printf("    WEXITSTATUS : %d\n", WEXITSTATUS(wstatus));
    59         printf("    WIFSIGNALED : %d\n", WIFSIGNALED(wstatus));
    60         printf("    WTERMSIG    : %d\n", WTERMSIG(wstatus));
    61         printf("    WCOREDUMP   : %d\n", WCOREDUMP(wstatus));
    62         printf("    WIFSTOPPED  : %d\n", WIFSTOPPED(wstatus));
    63         printf("    WSTOPSIG    : %d\n", WSTOPSIG(wstatus));
    64         printf("    WIFCONTINUED: %d\n", WIFCONTINUED(wstatus));
     57        printf("IFEXITED   : %d, ", WIFEXITED(wstatus));
     58        printf("EXITSTATUS : %d, ", WEXITSTATUS(wstatus));
     59        printf("IFSIGNALED : %d, ", WIFSIGNALED(wstatus));
     60        printf("TERMSIG    : %d, ", WTERMSIG(wstatus));
     61        printf("COREDUMP   : %d, ", WCOREDUMP(wstatus));
     62        printf("IFSTOPPED  : %d, ", WIFSTOPPED(wstatus));
     63        printf("STOPSIG    : %d, ", WSTOPSIG(wstatus));
     64        printf("IFCONTINUED: %d", WIFCONTINUED(wstatus));
     65        printf("\n");
     66        printf("\n");
    6567}
    6668
Note: See TracChangeset for help on using the changeset viewer.