2 * Copyright © 2013 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * Note that test function (and code called by them) should generally not return
31 * a variable indicating success/failure. Instead use the igt_require/igt_assert
32 * macros to skip out of the entire subtest.
34 * Also, helper functions should only return a status code if the callers have a
35 * real need to differentiate. If the only thing they do is call igt_assert or a
36 * similar macro then it'll result in simpler code when the check is moved
37 * completely into the helper.
39 static void test_A(int fd)
43 static void test_B(int fd)
48 * Variables which are written to in igt_fixtures/subtest blocks need to be
49 * allocated outside of the relevant function scope, otherwise gcc will wreak
50 * havoc (since these magic blocks use setjmp/longjmp internally).
52 * Common practice is to put variables used in the main test function into
53 * global scope, but only right above the main function itself (to avoid leaking
54 * it into other functions).
62 drm_fd = drm_open_any();
63 igt_require(drm_fd >= 0);
65 /* Set up other interesting stuff shared by all tests. */
73 * Note that subtest names can be programatically generated. See the
74 * various uses of igt_subtest_f for a few neat ideas.