2 * Copyright © 2020 Valve 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
24 #ifndef ACO_TEST_COMMON_H
25 #define ACO_TEST_COMMON_H
30 #include "amd_family.h"
32 #include "aco_builder.h"
33 #include "vulkan/radv_shader.h"
37 const char *source_file
;
41 extern std::map
<std::string
, TestDef
> tests
;
44 bool set_variant(const char *name
);
46 inline bool set_variant(chip_class cls
, const char *rest
="")
48 char buf
[8+strlen(rest
)];
49 snprintf(buf
, sizeof(buf
), "gfx%d%s", cls
- GFX6
+ 6, rest
);
50 return set_variant(buf
);
53 void fail_test(const char *fmt
, ...);
54 void skip_test(const char *fmt
, ...);
56 #define _PASTE(a, b) a##b
57 #define PASTE(a, b) _PASTE(a, b)
59 #define _BEGIN_TEST(name, struct_name) static void struct_name(); static __attribute__((constructor)) void PASTE(add_test_, __COUNTER__)() {\
60 tests[#name] = (TestDef){#name, ACO_TEST_BUILD_ROOT "/" __FILE__, &struct_name};\
62 static void struct_name() {\
64 #define BEGIN_TEST(name) _BEGIN_TEST(name, PASTE(Test_, __COUNTER__))
65 #define BEGIN_TEST_TODO(name) _BEGIN_TEST(name, PASTE(Test_, __COUNTER__))
66 #define BEGIN_TEST_FAIL(name) _BEGIN_TEST(name, PASTE(Test_, __COUNTER__))
70 #endif /* ACO_TEST_COMMON_H */