xref: /minix/external/bsd/bind/dist/unit/atf-src/TODO (revision 00b67f09)
1*00b67f09SDavid van MoolenbroekThings to do                                    Automated Testing Framework
2*00b67f09SDavid van Moolenbroek===========================================================================
3*00b67f09SDavid van Moolenbroek
4*00b67f09SDavid van Moolenbroek
5*00b67f09SDavid van MoolenbroekLast revised: November 30th, 2010
6*00b67f09SDavid van Moolenbroek
7*00b67f09SDavid van Moolenbroek
8*00b67f09SDavid van MoolenbroekThis document includes the list of things that need to be done in ATF that
9*00b67f09SDavid van Moolenbroekare most requested by the users. This information used to be available in
10*00b67f09SDavid van Moolenbroekan ad-hoc bug tracker but that proved to be a bad idea. I have collected
11*00b67f09SDavid van Moolenbroekall worthy comments in here.
12*00b67f09SDavid van Moolenbroek
13*00b67f09SDavid van MoolenbroekPlease note that most work these days is going into Kyua (see
14*00b67f09SDavid van Moolenbroekhttp://code.google.com/p/kyua/). The ideas listed here apply to the
15*00b67f09SDavid van Moolenbroekcomponents of ATF that have *not* been migrated to the new codebase yet.
16*00b67f09SDavid van MoolenbroekFor bug reports or ideas that apply to the components that already have
17*00b67f09SDavid van Moolenbroekbeen migrated, please use the bug tracker in the URL above. Similarly,
18*00b67f09SDavid van Moolenbroekwhenever a component is migrated, the ideas in this file should be revised
19*00b67f09SDavid van Moolenbroekand migrated to the new bug tracker where appropriate.
20*00b67f09SDavid van Moolenbroek
21*00b67f09SDavid van Moolenbroek
22*00b67f09SDavid van Moolenbroek---------------------------------------------------------------------------
23*00b67f09SDavid van MoolenbroekAdd build-time checks to atf-sh
24*00b67f09SDavid van Moolenbroek
25*00b67f09SDavid van MoolenbroekThe 0.7 release introduced build-time tests to atf-c and atf-c++, but not
26*00b67f09SDavid van Moolenbroekto atf-sh. Expose the functionality to the shell interface.
27*00b67f09SDavid van Moolenbroek
28*00b67f09SDavid van MoolenbroekThis will probably require writing an atf-build utility that exposes the C
29*00b67f09SDavid van Moolenbroekcode and can be called from the shell.
30*00b67f09SDavid van Moolenbroek
31*00b67f09SDavid van Moolenbroek---------------------------------------------------------------------------
32*00b67f09SDavid van MoolenbroekRevisit what to do when an Atffile lists a non-existent file
33*00b67f09SDavid van Moolenbroek
34*00b67f09SDavid van Moolenbroek---------------------------------------------------------------------------
35*00b67f09SDavid van MoolenbroekAdd ATF_CHECK* versions to atf-c++ to support non-fatal tests
36*00b67f09SDavid van Moolenbroek
37*00b67f09SDavid van Moolenbroek---------------------------------------------------------------------------
38*00b67f09SDavid van MoolenbroekImplement race-condition tests
39*00b67f09SDavid van Moolenbroek
40*00b67f09SDavid van Moolenbroekgcooper:
41*00b67f09SDavid van Moolenbroek
42*00b67f09SDavid van MoolenbroekI would think that stress/negative tests would be of more value than race
43*00b67f09SDavid van Moolenbroekcondition tests (they're similar, but not exactly the same in my mind).
44*00b67f09SDavid van Moolenbroek
45*00b67f09SDavid van MoolenbroekIn particular,
46*00b67f09SDavid van Moolenbroek
47*00b67f09SDavid van Moolenbroek1. Feed through as much data as possible to determine where reporting
48*00b67f09SDavid van Moolenbroek   breaks down.
49*00b67f09SDavid van Moolenbroek2. Feed through data quickly and terminate ASAP. The data should be
50*00b67f09SDavid van Moolenbroek   captured. Terminate child applications with unexpected exit codes and
51*00b67f09SDavid van Moolenbroek   signals (in particular, SIGCHLD, SIGPIPE, exit codes that terminate,
52*00b67f09SDavid van Moolenbroek   etc).
53*00b67f09SDavid van Moolenbroek3. Open up a file descriptor in the test application, don't close the file
54*00b67f09SDavid van Moolenbroek   descriptor.
55*00b67f09SDavid van Moolenbroek4. fork(2) a process; don't wait(2) for the application to complete.
56*00b67f09SDavid van Moolenbroek
57*00b67f09SDavid van MoolenbroekThere are other scenarios that could be exercised, but these are the ones
58*00b67f09SDavid van MoolenbroekI could think of off the topic of my head.
59*00b67f09SDavid van Moolenbroek
60*00b67f09SDavid van Moolenbroek--
61*00b67f09SDavid van Moolenbroek
62*00b67f09SDavid van Moolenbroekjmmv:
63*00b67f09SDavid van Moolenbroek
64*00b67f09SDavid van Moolenbroek1. The thing is: how do you express any of this in a portable/abstract
65*00b67f09SDavid van Moolenbroek   interface? How do you express that a test case "receives data"? What
66*00b67f09SDavid van Moolenbroek   does that exactly mean? I don't think the framework should care about
67*00b67f09SDavid van Moolenbroek   this: each test should be free to decide where its data is and how to
68*00b67f09SDavid van Moolenbroek   deal with it.
69*00b67f09SDavid van Moolenbroek
70*00b67f09SDavid van Moolenbroek2. Ditto.
71*00b67f09SDavid van Moolenbroek
72*00b67f09SDavid van Moolenbroek3. Not sure I understand your request, but testing for "unexpected exit
73*00b67f09SDavid van Moolenbroek   codes" is already supported. See wiki:DesignXFail for the feature
74*00b67f09SDavid van Moolenbroek   design details.
75*00b67f09SDavid van Moolenbroek
76*00b67f09SDavid van Moolenbroek4. What's the problem with this case? The test case exits right away after
77*00b67f09SDavid van Moolenbroek   terminating the execution of its body; any open file descriptors,
78*00b67f09SDavid van Moolenbroek   leaked memory, etc. die with it.
79*00b67f09SDavid van Moolenbroek
80*00b67f09SDavid van Moolenbroek5. forking and not waiting for a subprocess was a problem already
81*00b67f09SDavid van Moolenbroek   addressed.
82*00b67f09SDavid van Moolenbroek
83*00b67f09SDavid van MoolenbroekI kinda have an idea of what Antti means with "race condition tests", but
84*00b67f09SDavid van Moolenbroekevery time I have tried to describe my understanding of matters I seem to
85*00b67f09SDavid van Moolenbroekbe wrong. Would be nice to have a clear description of what this involves;
86*00b67f09SDavid van Moolenbroekin particular, what are the expectations from the framework and how should
87*00b67f09SDavid van Moolenbroekthe feature be exposed.
88*00b67f09SDavid van Moolenbroek
89*00b67f09SDavid van MoolenbroekAs of now, what I understand by "race condition test" is: a test case that
90*00b67f09SDavid van Moolenbroekexercises a race condition. The test case may finish without triggering
91*00b67f09SDavid van Moolenbroekthe race, in which case it just exists with a successful status.
92*00b67f09SDavid van MoolenbroekOtherwise, if the race triggers, the test case gets stuck and times out.
93*00b67f09SDavid van MoolenbroekThe result should be reported as an "expected failure" different from
94*00b67f09SDavid van Moolenbroektimeout.
95*00b67f09SDavid van Moolenbroek
96*00b67f09SDavid van Moolenbroek--
97*00b67f09SDavid van Moolenbroek
98*00b67f09SDavid van Moolenbroekpooka:
99*00b67f09SDavid van Moolenbroek
100*00b67f09SDavid van MoolenbroekYup. Plus some atf-wide mechanism for the operator to supply some kind of
101*00b67f09SDavid van Moolenbroekguideline if the test should try to trigger the race for a second or for
102*00b67f09SDavid van Moolenbroekan hour.
103*00b67f09SDavid van Moolenbroek
104*00b67f09SDavid van Moolenbroek--
105*00b67f09SDavid van Moolenbroek
106*00b67f09SDavid van Moolenbroekjmmv:
107*00b67f09SDavid van Moolenbroek
108*00b67f09SDavid van MoolenbroekAlright. While mocking up some code for this, I think that your two
109*00b67f09SDavid van Moolenbroekrequests are complementary.
110*00b67f09SDavid van Moolenbroek
111*00b67f09SDavid van MoolenbroekOn the one hand, when you are talking about a "race condition" test you
112*00b67f09SDavid van Moolenbroekreally mean an "expected race condition" test. Correct? If so, we need to
113*00b67f09SDavid van Moolenbroekextend the xfail mechanism to add one more case, which is to report any
114*00b67f09SDavid van Moolenbroekfailures as a race condition error and, if there is no failure, report the
115*00b67f09SDavid van Moolenbroektest as successful.
116*00b67f09SDavid van Moolenbroek
117*00b67f09SDavid van MoolenbroekOn the other hand, the atf-wide mechanism to support how long the test
118*00b67f09SDavid van Moolenbroekshould run for can be thought as a "stress test" mechanism. I.e. run this
119*00b67f09SDavid van Moolenbroektest for X time / iterations and report its results regularly without
120*00b67f09SDavid van Moolenbroekinvolving xfail at all.
121*00b67f09SDavid van Moolenbroek
122*00b67f09SDavid van MoolenbroekSo, with this in mind:
123*00b67f09SDavid van Moolenbroek
124*00b67f09SDavid van Moolenbroek* For a test that triggers an unfixed race condition, you set xfail to
125*00b67f09SDavid van Moolenbroek  race mode and define the test as a stress test. Any failures are
126*00b67f09SDavid van Moolenbroek  reported as expected failures.
127*00b67f09SDavid van Moolenbroek
128*00b67f09SDavid van Moolenbroek* For a test that verifies a supposedly-fixed race condition, you do *not*
129*00b67f09SDavid van Moolenbroek  set xfail to race mode, and only set the test to stress test. Any
130*00b67f09SDavid van Moolenbroek  failures are reported as real failures.
131*00b67f09SDavid van Moolenbroek
132*00b67f09SDavid van MoolenbroekThese stress test cases implement a single iteration of the test and
133*00b67f09SDavid van Moolenbroekatf-run is in charge of running the test several times, stopping on the
134*00b67f09SDavid van Moolenbroekfirst failure.
135*00b67f09SDavid van Moolenbroek
136*00b67f09SDavid van MoolenbroekDoes that make sense?
137*00b67f09SDavid van Moolenbroek
138*00b67f09SDavid van Moolenbroek---------------------------------------------------------------------------
139*00b67f09SDavid van MoolenbroekImplement ATF_REQUIRE_ERRNO
140*00b67f09SDavid van Moolenbroek
141*00b67f09SDavid van Moolenbroekpooka:
142*00b67f09SDavid van Moolenbroek
143*00b67f09SDavid van MoolenbroekMost of the lines in tests against system functionality are:
144*00b67f09SDavid van Moolenbroek
145*00b67f09SDavid van Moolenbroekif (syscall(args) == -1)
146*00b67f09SDavid van Moolenbroek    atf_tc_fail_errno("flop")
147*00b67f09SDavid van Moolenbroek
148*00b67f09SDavid van MoolenbroekSome shorthand would be helpful, like ATF_REQUIRE_ERRNO(syscall(args))
149*00b67f09SDavid van MoolenbroekAlso, a variant which allows arbitrary return value checks (e.g. "!= 0" or
150*00b67f09SDavid van Moolenbroek"< 124" or "!= size") would be nice.
151*00b67f09SDavid van Moolenbroek
152*00b67f09SDavid van Moolenbroek--
153*00b67f09SDavid van Moolenbroek
154*00b67f09SDavid van Moolenbroekgcooper:
155*00b67f09SDavid van Moolenbroek
156*00b67f09SDavid van MoolenbroekThere's a problem with this request; not all functions fail in the same
157*00b67f09SDavid van Moolenbroekway ... in particular compare the pthread family of functions (which
158*00b67f09SDavid van Moolenbroekreturn errno) vs many native syscalls. Furthermore, compare some
159*00b67f09SDavid van Moolenbroekfcntl-like syscalls vs other syscalls. One size fits all solutions may not
160*00b67f09SDavid van Moolenbroekbe a wise idea in this case, so I think that the problem statement needs
161*00b67f09SDavid van Moolenbroekto be better defined, because the above request is too loose.
162*00b67f09SDavid van Moolenbroek
163*00b67f09SDavid van MoolenbroekFWIW, there's also a TEST macro in LTP, which tests for non-zero status,
164*00b67f09SDavid van Moolenbroekand sets an appropriate set of global variables for errnos and return
165*00b67f09SDavid van Moolenbroekcodes, respectively. It was a good idea, but has been mostly abandoned
166*00b67f09SDavid van Moolenbroekbecause it's too difficult to define a success and failure in a universal
167*00b67f09SDavid van Moolenbroekmanner, so I think that we need to be careful with what's implemented in
168*00b67f09SDavid van MoolenbroekATF to not repeat the mistakes that others have made.
169*00b67f09SDavid van Moolenbroek
170*00b67f09SDavid van Moolenbroek--
171*00b67f09SDavid van Moolenbroek
172*00b67f09SDavid van Moolenbroekjmmv:
173*00b67f09SDavid van Moolenbroek
174*00b67f09SDavid van MoolenbroekI think you've got a good point.
175*00b67f09SDavid van Moolenbroek
176*00b67f09SDavid van MoolenbroekThis was mostly intended to simplify the handling of the stupid errno
177*00b67f09SDavid van Moolenbroekglobal variable. I think this is valuable to have, but maybe the
178*00b67f09SDavid van Moolenbroekmacro/function name should be different because _ERRNO can be confusing.
179*00b67f09SDavid van MoolenbroekProbably something like an ATF_CHECK_LIBC / ATF_CHECK_PTHREAD approach
180*00b67f09SDavid van Moolenbroekwould be more flexible and simple.
181*00b67f09SDavid van Moolenbroek
182*00b67f09SDavid van Moolenbroek
183*00b67f09SDavid van Moolenbroek===========================================================================
184*00b67f09SDavid van Moolenbroekvim: filetype=text:textwidth=75:expandtab:shiftwidth=2:softtabstop=2
185