~jamesodhunt/upstart/stateful-reexec-dbus-connections

« back to all changes in this revision

Viewing changes to init/tests/test_job.c

  • Committer: James Hunt
  • Date: 2012-08-29 08:43:31 UTC
  • mfrom: (1420.1.8 stateful-reexec)
  • Revision ID: james.hunt@ubuntu.com-20120829084331-wsfdakw0140euzmr
Merge of lp:~vorlon/upstart/stateful-reexec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
                TEST_LIST_EMPTY (&job->blocking);
136
136
 
137
137
                TEST_EQ_P (job->kill_timer, NULL);
138
 
                TEST_EQ (job->kill_process, (ProcessType)-1);
 
138
                TEST_EQ (job->kill_process, PROCESS_INVALID);
139
139
 
140
140
                TEST_EQ (job->failed, FALSE);
141
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
141
                TEST_EQ (job->failed_process, PROCESS_INVALID);
142
142
                TEST_EQ (job->exit_status, 0);
143
143
 
144
144
                TEST_EQ (job->respawn_count, 0);
834
834
                TEST_LIST_EMPTY (events);
835
835
 
836
836
                TEST_EQ (job->failed, FALSE);
837
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
837
                TEST_EQ (job->failed_process, PROCESS_INVALID);
838
838
                TEST_EQ (job->exit_status, 0);
839
839
 
840
840
                nih_free (job);
923
923
                TEST_LIST_EMPTY (events);
924
924
 
925
925
                TEST_EQ (job->failed, FALSE);
926
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
926
                TEST_EQ (job->failed_process, PROCESS_INVALID);
927
927
                TEST_EQ (job->exit_status, 0);
928
928
 
929
929
                nih_free (job);
1011
1011
                TEST_LIST_EMPTY (events);
1012
1012
 
1013
1013
                TEST_EQ (job->failed, FALSE);
1014
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1014
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1015
1015
                TEST_EQ (job->exit_status, 0);
1016
1016
 
1017
1017
                nih_free (job);
1044
1044
                TEST_FREE_TAG (blocked);
1045
1045
 
1046
1046
                job->failed = FALSE;
1047
 
                job->failed_process = -1;
 
1047
                job->failed_process = PROCESS_INVALID;
1048
1048
                job->exit_status = 0;
1049
1049
 
1050
1050
                job_change_state (job, JOB_PRE_START);
1075
1075
                TEST_LIST_EMPTY (events);
1076
1076
 
1077
1077
                TEST_EQ (job->failed, FALSE);
1078
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1078
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1079
1079
                TEST_EQ (job->exit_status, 0);
1080
1080
 
1081
1081
                nih_free (job);
1110
1110
                TEST_FREE_TAG (blocked);
1111
1111
 
1112
1112
                job->failed = FALSE;
1113
 
                job->failed_process = -1;
 
1113
                job->failed_process = PROCESS_INVALID;
1114
1114
                job->exit_status = 0;
1115
1115
 
1116
1116
                job_change_state (job, JOB_PRE_START);
1148
1148
                TEST_LIST_EMPTY (events);
1149
1149
 
1150
1150
                TEST_EQ (job->failed, FALSE);
1151
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1151
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1152
1152
                TEST_EQ (job->exit_status, 0);
1153
1153
 
1154
1154
                nih_free (job);
1184
1184
                TEST_FREE_TAG (blocked);
1185
1185
 
1186
1186
                job->failed = FALSE;
1187
 
                job->failed_process = -1;
 
1187
                job->failed_process = PROCESS_INVALID;
1188
1188
                job->exit_status = 0;
1189
1189
 
1190
1190
                TEST_DIVERT_STDERR (output) {
1269
1269
                TEST_FREE_TAG (blocked);
1270
1270
 
1271
1271
                job->failed = FALSE;
1272
 
                job->failed_process = -1;
 
1272
                job->failed_process = PROCESS_INVALID;
1273
1273
                job->exit_status = 0;
1274
1274
 
1275
1275
                job_change_state (job, JOB_SPAWNED);
1307
1307
                TEST_LIST_EMPTY (events);
1308
1308
 
1309
1309
                TEST_EQ (job->failed, FALSE);
1310
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1310
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1311
1311
                TEST_EQ (job->exit_status, 0);
1312
1312
 
1313
1313
                nih_free (job);
1337
1337
                TEST_FREE_TAG (blocked);
1338
1338
 
1339
1339
                job->failed = FALSE;
1340
 
                job->failed_process = -1;
 
1340
                job->failed_process = PROCESS_INVALID;
1341
1341
                job->exit_status = 0;
1342
1342
 
1343
1343
                job_change_state (job, JOB_SPAWNED);
1375
1375
                TEST_LIST_EMPTY (events);
1376
1376
 
1377
1377
                TEST_EQ (job->failed, FALSE);
1378
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1378
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1379
1379
                TEST_EQ (job->exit_status, 0);
1380
1380
 
1381
1381
                nih_free (job);
1417
1417
                TEST_FREE_TAG (blocked);
1418
1418
 
1419
1419
                job->failed = FALSE;
1420
 
                job->failed_process = -1;
 
1420
                job->failed_process = PROCESS_INVALID;
1421
1421
                job->exit_status = 0;
1422
1422
 
1423
1423
                job_change_state (job, JOB_SPAWNED);
1456
1456
                TEST_LIST_EMPTY (events);
1457
1457
 
1458
1458
                TEST_EQ (job->failed, FALSE);
1459
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1459
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1460
1460
                TEST_EQ (job->exit_status, 0);
1461
1461
 
1462
1462
                nih_free (job);
1492
1492
                TEST_FREE_TAG (blocked);
1493
1493
 
1494
1494
                job->failed = FALSE;
1495
 
                job->failed_process = -1;
 
1495
                job->failed_process = PROCESS_INVALID;
1496
1496
                job->exit_status = 0;
1497
1497
 
1498
1498
                job_change_state (job, JOB_SPAWNED);
1520
1520
                TEST_LIST_EMPTY (events);
1521
1521
 
1522
1522
                TEST_EQ (job->failed, FALSE);
1523
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1523
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1524
1524
                TEST_EQ (job->exit_status, 0);
1525
1525
 
1526
1526
                nih_free (job);
1556
1556
                TEST_FREE_TAG (blocked);
1557
1557
 
1558
1558
                job->failed = FALSE;
1559
 
                job->failed_process = -1;
 
1559
                job->failed_process = PROCESS_INVALID;
1560
1560
                job->exit_status = 0;
1561
1561
 
1562
1562
                TEST_DIVERT_STDERR (output) {
1643
1643
                TEST_FREE_TAG (blocked);
1644
1644
 
1645
1645
                job->failed = FALSE;
1646
 
                job->failed_process = -1;
 
1646
                job->failed_process = PROCESS_INVALID;
1647
1647
                job->exit_status = 0;
1648
1648
 
1649
1649
                job_change_state (job, JOB_SPAWNED);
1674
1674
                TEST_LIST_EMPTY (events);
1675
1675
 
1676
1676
                TEST_EQ (job->failed, FALSE);
1677
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1677
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1678
1678
                TEST_EQ (job->exit_status, 0);
1679
1679
 
1680
1680
                nih_free (job);
1712
1712
                TEST_FREE_TAG (blocked);
1713
1713
 
1714
1714
                job->failed = FALSE;
1715
 
                job->failed_process = -1;
 
1715
                job->failed_process = PROCESS_INVALID;
1716
1716
                job->exit_status = 0;
1717
1717
 
1718
1718
                job_change_state (job, JOB_POST_START);
1744
1744
                TEST_LIST_EMPTY (events);
1745
1745
 
1746
1746
                TEST_EQ (job->failed, FALSE);
1747
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1747
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1748
1748
                TEST_EQ (job->exit_status, 0);
1749
1749
 
1750
1750
                nih_free (job);
1779
1779
                TEST_FREE_TAG (blocked);
1780
1780
 
1781
1781
                job->failed = FALSE;
1782
 
                job->failed_process = -1;
 
1782
                job->failed_process = PROCESS_INVALID;
1783
1783
                job->exit_status = 0;
1784
1784
 
1785
1785
                job_change_state (job, JOB_POST_START);
1808
1808
                TEST_LIST_EMPTY (events);
1809
1809
 
1810
1810
                TEST_EQ (job->failed, FALSE);
1811
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1811
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1812
1812
                TEST_EQ (job->exit_status, 0);
1813
1813
 
1814
1814
                nih_free (job);
1842
1842
                TEST_FREE_TAG (blocked);
1843
1843
 
1844
1844
                job->failed = FALSE;
1845
 
                job->failed_process = -1;
 
1845
                job->failed_process = PROCESS_INVALID;
1846
1846
                job->exit_status = 0;
1847
1847
 
1848
1848
                TEST_DIVERT_STDERR (output) {
1874
1874
                TEST_LIST_EMPTY (events);
1875
1875
 
1876
1876
                TEST_EQ (job->failed, FALSE);
1877
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1877
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1878
1878
                TEST_EQ (job->exit_status, 0);
1879
1879
 
1880
1880
                TEST_FILE_EQ (output, ("test: Failed to spawn test "
1913
1913
                TEST_FREE_TAG (blocked);
1914
1914
 
1915
1915
                job->failed = FALSE;
1916
 
                job->failed_process = -1;
 
1916
                job->failed_process = PROCESS_INVALID;
1917
1917
                job->exit_status = 0;
1918
1918
 
1919
1919
                job_change_state (job, JOB_RUNNING);
1942
1942
                TEST_LIST_EMPTY (events);
1943
1943
 
1944
1944
                TEST_EQ (job->failed, FALSE);
1945
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
1945
                TEST_EQ (job->failed_process, PROCESS_INVALID);
1946
1946
                TEST_EQ (job->exit_status, 0);
1947
1947
 
1948
1948
                nih_free (job);
1974
1974
                TEST_FREE_TAG (blocked);
1975
1975
 
1976
1976
                job->failed = FALSE;
1977
 
                job->failed_process = -1;
 
1977
                job->failed_process = PROCESS_INVALID;
1978
1978
                job->exit_status = 0;
1979
1979
 
1980
1980
                job_change_state (job, JOB_RUNNING);
2005
2005
                TEST_LIST_EMPTY (events);
2006
2006
 
2007
2007
                TEST_EQ (job->failed, FALSE);
2008
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
2008
                TEST_EQ (job->failed_process, PROCESS_INVALID);
2009
2009
                TEST_EQ (job->exit_status, 0);
2010
2010
 
2011
2011
                nih_free (job);
2043
2043
                TEST_FREE_TAG (blocked);
2044
2044
 
2045
2045
                job->failed = FALSE;
2046
 
                job->failed_process = -1;
 
2046
                job->failed_process = PROCESS_INVALID;
2047
2047
                job->exit_status = 0;
2048
2048
 
2049
2049
                job_change_state (job, JOB_PRE_STOP);
2075
2075
                TEST_LIST_EMPTY (events);
2076
2076
 
2077
2077
                TEST_EQ (job->failed, FALSE);
2078
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
2078
                TEST_EQ (job->failed_process, PROCESS_INVALID);
2079
2079
                TEST_EQ (job->exit_status, 0);
2080
2080
 
2081
2081
                nih_free (job);
2110
2110
                TEST_FREE_TAG (blocked);
2111
2111
 
2112
2112
                job->failed = FALSE;
2113
 
                job->failed_process = -1;
 
2113
                job->failed_process = PROCESS_INVALID;
2114
2114
                job->exit_status = 0;
2115
2115
 
2116
2116
                job_change_state (job, JOB_PRE_STOP);
2153
2153
                TEST_LIST_EMPTY (events);
2154
2154
 
2155
2155
                TEST_EQ (job->failed, FALSE);
2156
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
2156
                TEST_EQ (job->failed_process, PROCESS_INVALID);
2157
2157
                TEST_EQ (job->exit_status, 0);
2158
2158
 
2159
2159
                nih_free (job);
2183
2183
                TEST_FREE_TAG (blocked);
2184
2184
 
2185
2185
                job->failed = FALSE;
2186
 
                job->failed_process = -1;
 
2186
                job->failed_process = PROCESS_INVALID;
2187
2187
                job->exit_status = 0;
2188
2188
 
2189
2189
                job_change_state (job, JOB_PRE_STOP);
2226
2226
                TEST_LIST_EMPTY (events);
2227
2227
 
2228
2228
                TEST_EQ (job->failed, FALSE);
2229
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
2229
                TEST_EQ (job->failed_process, PROCESS_INVALID);
2230
2230
                TEST_EQ (job->exit_status, 0);
2231
2231
 
2232
2232
                nih_free (job);
2268
2268
                TEST_FREE_TAG (blocked);
2269
2269
 
2270
2270
                job->failed = FALSE;
2271
 
                job->failed_process = -1;
 
2271
                job->failed_process = PROCESS_INVALID;
2272
2272
                job->exit_status = 0;
2273
2273
 
2274
2274
                job_change_state (job, JOB_PRE_STOP);
2312
2312
                TEST_LIST_EMPTY (events);
2313
2313
 
2314
2314
                TEST_EQ (job->failed, FALSE);
2315
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
2315
                TEST_EQ (job->failed_process, PROCESS_INVALID);
2316
2316
                TEST_EQ (job->exit_status, 0);
2317
2317
 
2318
2318
                nih_free (job);
2348
2348
                TEST_FREE_TAG (blocked);
2349
2349
 
2350
2350
                job->failed = FALSE;
2351
 
                job->failed_process = -1;
 
2351
                job->failed_process = PROCESS_INVALID;
2352
2352
                job->exit_status = 0;
2353
2353
 
2354
2354
                TEST_DIVERT_STDERR (output) {
2394
2394
                TEST_LIST_EMPTY (events);
2395
2395
 
2396
2396
                TEST_EQ (job->failed, FALSE);
2397
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
2397
                TEST_EQ (job->failed_process, PROCESS_INVALID);
2398
2398
                TEST_EQ (job->exit_status, 0);
2399
2399
 
2400
2400
                TEST_FILE_EQ (output, ("test: Failed to spawn test "
2827
2827
                TEST_FREE_TAG (env1);
2828
2828
 
2829
2829
                job->failed = FALSE;
2830
 
                job->failed_process = -1;
 
2830
                job->failed_process = PROCESS_INVALID;
2831
2831
                job->exit_status = 0;
2832
2832
 
2833
2833
                job_change_goal (job, JOB_START);
2850
2850
                TEST_LIST_EMPTY (events);
2851
2851
 
2852
2852
                TEST_EQ (job->failed, FALSE);
2853
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
2853
                TEST_EQ (job->failed_process, PROCESS_INVALID);
2854
2854
                TEST_EQ (job->exit_status, 0);
2855
2855
 
2856
2856
                nih_free (job);
2880
2880
                TEST_FREE_TAG (blocked);
2881
2881
 
2882
2882
                job->failed = FALSE;
2883
 
                job->failed_process = -1;
 
2883
                job->failed_process = PROCESS_INVALID;
2884
2884
                job->exit_status = 0;
2885
2885
 
2886
2886
                job_change_state (job, JOB_STOPPING);
2922
2922
                TEST_LIST_EMPTY (events);
2923
2923
 
2924
2924
                TEST_EQ (job->failed, FALSE);
2925
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
2925
                TEST_EQ (job->failed_process, PROCESS_INVALID);
2926
2926
                TEST_EQ (job->exit_status, 0);
2927
2927
 
2928
2928
                nih_free (job);
2957
2957
                TEST_FREE_TAG (blocked);
2958
2958
 
2959
2959
                job->failed = FALSE;
2960
 
                job->failed_process = -1;
 
2960
                job->failed_process = PROCESS_INVALID;
2961
2961
                job->exit_status = 0;
2962
2962
 
2963
2963
                job_change_state (job, JOB_KILLED);
2983
2983
                TEST_LIST_EMPTY (events);
2984
2984
 
2985
2985
                TEST_EQ (job->failed, FALSE);
2986
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
2986
                TEST_EQ (job->failed_process, PROCESS_INVALID);
2987
2987
                TEST_EQ (job->exit_status, 0);
2988
2988
 
2989
2989
                TEST_NE_P (job->kill_timer, NULL);
2991
2991
 
2992
2992
                nih_free (job->kill_timer);
2993
2993
                job->kill_timer = NULL;
2994
 
                job->kill_process = -1;
 
2994
                job->kill_process = PROCESS_INVALID;
2995
2995
 
2996
2996
                nih_free (job);
2997
2997
        }
3021
3021
                TEST_FREE_TAG (blocked);
3022
3022
 
3023
3023
                job->failed = FALSE;
3024
 
                job->failed_process = -1;
 
3024
                job->failed_process = PROCESS_INVALID;
3025
3025
                job->exit_status = 0;
3026
3026
 
3027
3027
                job_change_state (job, JOB_KILLED);
3052
3052
                TEST_LIST_EMPTY (events);
3053
3053
 
3054
3054
                TEST_EQ (job->failed, FALSE);
3055
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
3055
                TEST_EQ (job->failed_process, PROCESS_INVALID);
3056
3056
                TEST_EQ (job->exit_status, 0);
3057
3057
 
3058
3058
                TEST_EQ_P (job->kill_timer, NULL);
3059
 
                TEST_EQ (job->kill_process, (ProcessType)-1);
 
3059
                TEST_EQ (job->kill_process, PROCESS_INVALID);
3060
3060
 
3061
3061
                nih_free (job);
3062
3062
        }
3085
3085
                TEST_FREE_TAG (blocked);
3086
3086
 
3087
3087
                job->failed = FALSE;
3088
 
                job->failed_process = -1;
 
3088
                job->failed_process = PROCESS_INVALID;
3089
3089
                job->exit_status = 0;
3090
3090
 
3091
3091
                job_change_state (job, JOB_POST_STOP);
3116
3116
                TEST_LIST_EMPTY (events);
3117
3117
 
3118
3118
                TEST_EQ (job->failed, FALSE);
3119
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
3119
                TEST_EQ (job->failed_process, PROCESS_INVALID);
3120
3120
                TEST_EQ (job->exit_status, 0);
3121
3121
 
3122
3122
                nih_free (job);
3210
3210
                TEST_FREE_TAG (blocked);
3211
3211
 
3212
3212
                job->failed = FALSE;
3213
 
                job->failed_process = -1;
 
3213
                job->failed_process = PROCESS_INVALID;
3214
3214
                job->exit_status = 0;
3215
3215
 
3216
3216
                TEST_FREE_TAG (job);
3643
3643
                TEST_LIST_EMPTY (events);
3644
3644
 
3645
3645
                TEST_EQ (job->failed, FALSE);
3646
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
3646
                TEST_EQ (job->failed_process, PROCESS_INVALID);
3647
3647
                TEST_EQ (job->exit_status, 0);
3648
3648
 
3649
3649
                nih_free (job);
3726
3726
                TEST_LIST_EMPTY (events);
3727
3727
 
3728
3728
                TEST_EQ (job->failed, FALSE);
3729
 
                TEST_EQ (job->failed_process, (ProcessType)-1);
 
3729
                TEST_EQ (job->failed_process, PROCESS_INVALID);
3730
3730
                TEST_EQ (job->exit_status, 0);
3731
3731
 
3732
3732
                nih_free (job);
5013
5013
        job->goal = JOB_STOP;
5014
5014
        job->state = JOB_STOPPING;
5015
5015
        job->failed = TRUE;
5016
 
        job->failed_process = -1;
 
5016
        job->failed_process = PROCESS_INVALID;
5017
5017
        job->exit_status = -1;
5018
5018
 
5019
5019
        TEST_ALLOC_FAIL {
5059
5059
        job->goal = JOB_STOP;
5060
5060
        job->state = JOB_STOPPING;
5061
5061
        job->failed = TRUE;
5062
 
        job->failed_process = -1;
 
5062
        job->failed_process = PROCESS_INVALID;
5063
5063
        job->exit_status = -1;
5064
5064
 
5065
5065
        TEST_ALLOC_FAIL {
5469
5469
        job->goal = JOB_STOP;
5470
5470
        job->state = JOB_WAITING;
5471
5471
        job->failed = TRUE;
5472
 
        job->failed_process = -1;
 
5472
        job->failed_process = PROCESS_INVALID;
5473
5473
        job->exit_status = -1;
5474
5474
 
5475
5475
        TEST_ALLOC_FAIL {
5506
5506
        job->goal = JOB_STOP;
5507
5507
        job->state = JOB_WAITING;
5508
5508
        job->failed = TRUE;
5509
 
        job->failed_process = -1;
 
5509
        job->failed_process = PROCESS_INVALID;
5510
5510
        job->exit_status = -1;
5511
5511
 
5512
5512
        TEST_ALLOC_FAIL {