16ef284f1SJohn Levon /*
26ef284f1SJohn Levon  * This file and its contents are supplied under the terms of the
36ef284f1SJohn Levon  * Common Development and Distribution License ("CDDL"), version 1.0.
46ef284f1SJohn Levon  * You may only use this file in accordance with the terms of version
56ef284f1SJohn Levon  * 1.0 of the CDDL.
66ef284f1SJohn Levon  *
76ef284f1SJohn Levon  * A full copy of the text of the CDDL should have accompanied this
86ef284f1SJohn Levon  * source.  A copy of the CDDL is also available via the Internet at
96ef284f1SJohn Levon  * http://www.illumos.org/license/CDDL.
106ef284f1SJohn Levon  */
116ef284f1SJohn Levon 
126ef284f1SJohn Levon /*
136ef284f1SJohn Levon  * Copyright 2019, Joyent, Inc.
146ef284f1SJohn Levon  */
156ef284f1SJohn Levon 
166ef284f1SJohn Levon /*
176ef284f1SJohn Levon  * Check qualifier encoding. Note that the needed_qualifier() workaround applies
186ef284f1SJohn Levon  * to most of these.
196ef284f1SJohn Levon  */
206ef284f1SJohn Levon 
216ef284f1SJohn Levon #include "check-common.h"
226ef284f1SJohn Levon 
236ef284f1SJohn Levon static check_descent_t check_descent_const_union_array_gcc4[] = {
246ef284f1SJohn Levon 	{ "const union const_union [5]", CTF_K_CONST },
256ef284f1SJohn Levon 	{ "union const_union [5]", CTF_K_ARRAY, "union const_union", 5 },
266ef284f1SJohn Levon 	{ "union const_union", CTF_K_UNION },
276ef284f1SJohn Levon 	{ NULL }
286ef284f1SJohn Levon };
296ef284f1SJohn Levon 
306ef284f1SJohn Levon static check_descent_t check_descent_const_union_array_gcc7[] = {
316ef284f1SJohn Levon 	{ "const union const_union [5]", CTF_K_ARRAY,
326ef284f1SJohn Levon 	    "const union const_union", 5 },
336ef284f1SJohn Levon 	{ "const union const_union", CTF_K_CONST },
346ef284f1SJohn Levon 	{ "union const_union", CTF_K_UNION },
356ef284f1SJohn Levon 	{ NULL }
366ef284f1SJohn Levon };
376ef284f1SJohn Levon 
386ef284f1SJohn Levon static check_descent_test_t alt_descents_const_union_array[] = {
396ef284f1SJohn Levon 	{ "const_union_array", check_descent_const_union_array_gcc4 },
406ef284f1SJohn Levon 	{ "const_union_array", check_descent_const_union_array_gcc7 },
416ef284f1SJohn Levon 	{ NULL }
426ef284f1SJohn Levon };
436ef284f1SJohn Levon 
446ef284f1SJohn Levon static check_descent_t check_descent_const_struct_array_gcc4[] = {
456ef284f1SJohn Levon 	{ "const struct const_struct [7]", CTF_K_CONST },
466ef284f1SJohn Levon 	{ "struct const_struct [7]", CTF_K_ARRAY, "struct const_struct", 7 },
476ef284f1SJohn Levon 	{ "struct const_struct", CTF_K_STRUCT },
486ef284f1SJohn Levon 	{ NULL }
496ef284f1SJohn Levon };
506ef284f1SJohn Levon 
516ef284f1SJohn Levon static check_descent_t check_descent_const_struct_array_gcc7[] = {
526ef284f1SJohn Levon 	{ "const struct const_struct [7]", CTF_K_ARRAY,
536ef284f1SJohn Levon 	    "const struct const_struct", 7 },
546ef284f1SJohn Levon 	{ "const struct const_struct", CTF_K_CONST },
556ef284f1SJohn Levon 	{ "struct const_struct", CTF_K_STRUCT },
566ef284f1SJohn Levon 	{ NULL }
576ef284f1SJohn Levon };
586ef284f1SJohn Levon 
596ef284f1SJohn Levon static check_descent_test_t alt_descents_const_struct_array[] = {
606ef284f1SJohn Levon 	{ "const_struct_array", check_descent_const_struct_array_gcc4 },
616ef284f1SJohn Levon 	{ "const_struct_array", check_descent_const_struct_array_gcc7 },
626ef284f1SJohn Levon 	{ NULL }
636ef284f1SJohn Levon };
646ef284f1SJohn Levon 
656ef284f1SJohn Levon static check_descent_t check_descent_volatile_struct_array_gcc4[] = {
666ef284f1SJohn Levon 	{ "volatile struct volatile_struct [9]", CTF_K_VOLATILE },
676ef284f1SJohn Levon 	{ "struct volatile_struct [9]", CTF_K_ARRAY,
686ef284f1SJohn Levon 	    "struct volatile_struct", 9 },
696ef284f1SJohn Levon 	{ "struct volatile_struct", CTF_K_STRUCT },
706ef284f1SJohn Levon 	{ NULL }
716ef284f1SJohn Levon };
726ef284f1SJohn Levon 
736ef284f1SJohn Levon static check_descent_t check_descent_volatile_struct_array_gcc7[] = {
746ef284f1SJohn Levon 	{ "volatile struct volatile_struct [9]", CTF_K_ARRAY,
756ef284f1SJohn Levon 	    "volatile struct volatile_struct", 9 },
766ef284f1SJohn Levon 	{ "volatile struct volatile_struct", CTF_K_VOLATILE },
776ef284f1SJohn Levon 	{ "struct volatile_struct", CTF_K_STRUCT },
786ef284f1SJohn Levon 	{ NULL }
796ef284f1SJohn Levon };
806ef284f1SJohn Levon 
816ef284f1SJohn Levon static check_descent_test_t alt_descents_volatile_struct_array[] = {
826ef284f1SJohn Levon 	{ "volatile_struct_array", check_descent_volatile_struct_array_gcc4 },
836ef284f1SJohn Levon 	{ "volatile_struct_array", check_descent_volatile_struct_array_gcc7 },
846ef284f1SJohn Levon 	{ NULL }
856ef284f1SJohn Levon };
866ef284f1SJohn Levon 
876ef284f1SJohn Levon static check_descent_t check_descent_c_int_array_gcc4[] = {
886ef284f1SJohn Levon 	{ "const int [11]", CTF_K_CONST },
896ef284f1SJohn Levon 	{ "int [11]", CTF_K_ARRAY, "int", 11 },
906ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
916ef284f1SJohn Levon 	{ NULL }
926ef284f1SJohn Levon };
936ef284f1SJohn Levon 
946ef284f1SJohn Levon static check_descent_t check_descent_c_int_array_gcc7[] = {
956ef284f1SJohn Levon 	{ "const int [11]", CTF_K_ARRAY, "const int", 11 },
966ef284f1SJohn Levon 	{ "const int", CTF_K_CONST },
976ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
986ef284f1SJohn Levon 	{ NULL }
996ef284f1SJohn Levon };
1006ef284f1SJohn Levon 
1016ef284f1SJohn Levon static check_descent_test_t alt_descents_c_int_array[] = {
1026ef284f1SJohn Levon 	{ "c_int_array", check_descent_c_int_array_gcc4 },
1036ef284f1SJohn Levon 	{ "c_int_array", check_descent_c_int_array_gcc7 },
1046ef284f1SJohn Levon 	{ NULL }
1056ef284f1SJohn Levon };
1066ef284f1SJohn Levon 
1076ef284f1SJohn Levon static check_descent_t check_descent_cv_int_array_gcc4[] = {
1086ef284f1SJohn Levon 	{ "const volatile int [13]", CTF_K_CONST },
1096ef284f1SJohn Levon 	{ "volatile int [13]", CTF_K_VOLATILE },
1106ef284f1SJohn Levon 	{ "int [13]", CTF_K_ARRAY, "int", 13 },
1116ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
1126ef284f1SJohn Levon 	{ NULL }
1136ef284f1SJohn Levon };
1146ef284f1SJohn Levon 
1156ef284f1SJohn Levon static check_descent_t check_descent_cv_int_array_gcc7[] = {
1166ef284f1SJohn Levon 	{ "volatile const int [13]", CTF_K_ARRAY, "volatile const int", 13 },
1176ef284f1SJohn Levon 	{ "volatile const int", CTF_K_VOLATILE },
1186ef284f1SJohn Levon 	{ "const int", CTF_K_CONST },
1196ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
1206ef284f1SJohn Levon 	{ NULL }
1216ef284f1SJohn Levon };
1226ef284f1SJohn Levon 
123*3cec9822SRobert Mustacchi static check_descent_t check_descent_cv_int_array_clang9[] = {
124*3cec9822SRobert Mustacchi 	{ "const volatile int [13]", CTF_K_ARRAY, "const volatile int", 13 },
125*3cec9822SRobert Mustacchi 	{ "const volatile int", CTF_K_CONST },
126*3cec9822SRobert Mustacchi 	{ "volatile int", CTF_K_VOLATILE },
127*3cec9822SRobert Mustacchi 	{ "int", CTF_K_INTEGER },
128*3cec9822SRobert Mustacchi 	{ NULL }
129*3cec9822SRobert Mustacchi };
130*3cec9822SRobert Mustacchi 
1316ef284f1SJohn Levon static check_descent_test_t alt_descents_cv_int_array[] = {
1326ef284f1SJohn Levon 	{ "cv_int_array", check_descent_cv_int_array_gcc4 },
1336ef284f1SJohn Levon 	{ "cv_int_array", check_descent_cv_int_array_gcc7 },
134*3cec9822SRobert Mustacchi 	{ "cv_int_array", check_descent_cv_int_array_clang9 },
1356ef284f1SJohn Levon 	{ NULL }
1366ef284f1SJohn Levon };
1376ef284f1SJohn Levon 
1386ef284f1SJohn Levon static check_descent_t check_descent_vc_int_array_gcc4[] = {
1396ef284f1SJohn Levon 	{ "const volatile int [15]", CTF_K_CONST },
1406ef284f1SJohn Levon 	{ "volatile int [15]", CTF_K_VOLATILE },
1416ef284f1SJohn Levon 	{ "int [15]", CTF_K_ARRAY, "int", 15 },
1426ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
1436ef284f1SJohn Levon 	{ NULL }
1446ef284f1SJohn Levon };
1456ef284f1SJohn Levon 
1466ef284f1SJohn Levon static check_descent_t check_descent_vc_int_array_gcc7[] = {
1476ef284f1SJohn Levon 	{ "volatile const int [15]", CTF_K_ARRAY, "volatile const int", 15 },
1486ef284f1SJohn Levon 	{ "volatile const int", CTF_K_VOLATILE },
1496ef284f1SJohn Levon 	{ "const int", CTF_K_CONST },
1506ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
1516ef284f1SJohn Levon 	{ NULL }
1526ef284f1SJohn Levon };
1536ef284f1SJohn Levon 
154*3cec9822SRobert Mustacchi static check_descent_t check_descent_vc_int_array_clang9[] = {
155*3cec9822SRobert Mustacchi 	{ "const volatile int [15]", CTF_K_ARRAY, "const volatile int", 15 },
156*3cec9822SRobert Mustacchi 	{ "const volatile int", CTF_K_CONST },
157*3cec9822SRobert Mustacchi 	{ "volatile int", CTF_K_VOLATILE },
158*3cec9822SRobert Mustacchi 	{ "int", CTF_K_INTEGER },
159*3cec9822SRobert Mustacchi 	{ NULL }
160*3cec9822SRobert Mustacchi };
161*3cec9822SRobert Mustacchi 
1626ef284f1SJohn Levon static check_descent_test_t alt_descents_vc_int_array[] = {
1636ef284f1SJohn Levon 	{ "vc_int_array", check_descent_vc_int_array_gcc4 },
1646ef284f1SJohn Levon 	{ "vc_int_array", check_descent_vc_int_array_gcc7 },
165*3cec9822SRobert Mustacchi 	{ "vc_int_array", check_descent_vc_int_array_clang9 },
1666ef284f1SJohn Levon 	{ NULL }
1676ef284f1SJohn Levon };
1686ef284f1SJohn Levon 
1696ef284f1SJohn Levon static check_descent_t check_descent_vc_int_array2_gcc4[] = {
1706ef284f1SJohn Levon 	{ "const volatile int [17]", CTF_K_CONST },
1716ef284f1SJohn Levon 	{ "volatile int [17]", CTF_K_VOLATILE },
1726ef284f1SJohn Levon 	{ "int [17]", CTF_K_ARRAY, "int", 17 },
1736ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
1746ef284f1SJohn Levon 	{ NULL }
1756ef284f1SJohn Levon };
1766ef284f1SJohn Levon 
1776ef284f1SJohn Levon static check_descent_t check_descent_vc_int_array2_gcc7[] = {
1786ef284f1SJohn Levon 	{ "volatile const int [17]", CTF_K_ARRAY, "volatile const int", 17 },
1796ef284f1SJohn Levon 	{ "volatile const int", CTF_K_VOLATILE },
1806ef284f1SJohn Levon 	{ "const int", CTF_K_CONST },
1816ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
1826ef284f1SJohn Levon 	{ NULL }
1836ef284f1SJohn Levon };
1846ef284f1SJohn Levon 
185*3cec9822SRobert Mustacchi static check_descent_t check_descent_vc_int_array2_clang9[] = {
186*3cec9822SRobert Mustacchi 	{ "const volatile int [17]", CTF_K_ARRAY, "const volatile int", 17 },
187*3cec9822SRobert Mustacchi 	{ "const volatile int", CTF_K_CONST },
188*3cec9822SRobert Mustacchi 	{ "volatile int", CTF_K_VOLATILE },
189*3cec9822SRobert Mustacchi 	{ "int", CTF_K_INTEGER },
190*3cec9822SRobert Mustacchi 	{ NULL }
191*3cec9822SRobert Mustacchi };
192*3cec9822SRobert Mustacchi 
193*3cec9822SRobert Mustacchi 
1946ef284f1SJohn Levon static check_descent_test_t alt_descents_vc_int_array2[] = {
1956ef284f1SJohn Levon 	{ "vc_int_array2", check_descent_vc_int_array2_gcc4 },
1966ef284f1SJohn Levon 	{ "vc_int_array2", check_descent_vc_int_array2_gcc7 },
197*3cec9822SRobert Mustacchi 	{ "vc_int_array2", check_descent_vc_int_array2_clang9 },
1986ef284f1SJohn Levon 	{ NULL }
1996ef284f1SJohn Levon };
2006ef284f1SJohn Levon 
2016ef284f1SJohn Levon static check_descent_t check_descent_c_2d_array_gcc4[] = {
2026ef284f1SJohn Levon 	{ "const int [4][2]", CTF_K_CONST },
2036ef284f1SJohn Levon 	{ "int [4][2]", CTF_K_ARRAY, "int [2]", 4 },
2046ef284f1SJohn Levon 	{ "int [2]", CTF_K_ARRAY, "int", 2 },
2056ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
2066ef284f1SJohn Levon 	{ NULL }
2076ef284f1SJohn Levon };
2086ef284f1SJohn Levon 
2096ef284f1SJohn Levon static check_descent_t check_descent_c_2d_array_gcc7[] = {
2106ef284f1SJohn Levon 	{ "const int [4][2]", CTF_K_ARRAY, "const int [2]", 4 },
2116ef284f1SJohn Levon 	{ "const int [2]", CTF_K_ARRAY, "const int", 2 },
2126ef284f1SJohn Levon 	{ "const int", CTF_K_CONST },
2136ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
2146ef284f1SJohn Levon 	{ NULL }
2156ef284f1SJohn Levon };
2166ef284f1SJohn Levon 
2176ef284f1SJohn Levon static check_descent_test_t alt_descents_c_2d_array[] = {
2186ef284f1SJohn Levon 	{ "c_2d_array", check_descent_c_2d_array_gcc4 },
2196ef284f1SJohn Levon 	{ "c_2d_array", check_descent_c_2d_array_gcc7 },
2206ef284f1SJohn Levon 	{ NULL }
2216ef284f1SJohn Levon };
2226ef284f1SJohn Levon 
2236ef284f1SJohn Levon static check_descent_t check_descent_cv_3d_array_gcc4[] = {
2246ef284f1SJohn Levon 	{ "const volatile int [3][2][1]", CTF_K_CONST },
2256ef284f1SJohn Levon 	{ "volatile int [3][2][1]", CTF_K_VOLATILE },
2266ef284f1SJohn Levon 	{ "int [3][2][1]", CTF_K_ARRAY, "int [2][1]", 3 },
2276ef284f1SJohn Levon 	{ "int [2][1]", CTF_K_ARRAY, "int [1]", 2 },
2286ef284f1SJohn Levon 	{ "int [1]", CTF_K_ARRAY, "int", 1 },
2296ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
2306ef284f1SJohn Levon 	{ NULL }
2316ef284f1SJohn Levon };
2326ef284f1SJohn Levon 
2336ef284f1SJohn Levon static check_descent_t check_descent_cv_3d_array_gcc7[] = {
2346ef284f1SJohn Levon 	{ "volatile const int [3][2][1]", CTF_K_ARRAY,
2356ef284f1SJohn Levon 	    "volatile const int [2][1]", 3 },
2366ef284f1SJohn Levon 	{ "volatile const int [2][1]", CTF_K_ARRAY,
2376ef284f1SJohn Levon 	    "volatile const int [1]", 2 },
2386ef284f1SJohn Levon 	{ "volatile const int [1]", CTF_K_ARRAY, "volatile const int", 1 },
2396ef284f1SJohn Levon 	{ "volatile const int", CTF_K_VOLATILE },
2406ef284f1SJohn Levon 	{ "const int", CTF_K_CONST },
2416ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
2426ef284f1SJohn Levon 	{ NULL }
2436ef284f1SJohn Levon };
2446ef284f1SJohn Levon 
245*3cec9822SRobert Mustacchi static check_descent_t check_descent_cv_3d_array_clang9[] = {
246*3cec9822SRobert Mustacchi 	{ "const volatile int [3][2][1]", CTF_K_ARRAY,
247*3cec9822SRobert Mustacchi 	    "const volatile int [2][1]", 3 },
248*3cec9822SRobert Mustacchi 	{ "const volatile int [2][1]", CTF_K_ARRAY,
249*3cec9822SRobert Mustacchi 	    "const volatile int [1]", 2 },
250*3cec9822SRobert Mustacchi 	{ "const volatile int [1]", CTF_K_ARRAY,
251*3cec9822SRobert Mustacchi 	    "const volatile int", 1 },
252*3cec9822SRobert Mustacchi 	{ "const volatile int", CTF_K_CONST },
253*3cec9822SRobert Mustacchi 	{ "volatile int", CTF_K_VOLATILE },
254*3cec9822SRobert Mustacchi 	{ "int", CTF_K_INTEGER },
255*3cec9822SRobert Mustacchi 	{ NULL }
256*3cec9822SRobert Mustacchi };
257*3cec9822SRobert Mustacchi 
258*3cec9822SRobert Mustacchi 
2596ef284f1SJohn Levon static check_descent_test_t alt_descents_cv_3d_array[] = {
2606ef284f1SJohn Levon 	{ "cv_3d_array", check_descent_cv_3d_array_gcc4 },
2616ef284f1SJohn Levon 	{ "cv_3d_array", check_descent_cv_3d_array_gcc7 },
262*3cec9822SRobert Mustacchi 	{ "cv_3d_array", check_descent_cv_3d_array_clang9 },
2636ef284f1SJohn Levon 	{ NULL }
2646ef284f1SJohn Levon };
2656ef284f1SJohn Levon 
2666ef284f1SJohn Levon static check_descent_t check_descent_ptr_to_const_int[] = {
2676ef284f1SJohn Levon 	{ "const int *", CTF_K_POINTER },
2686ef284f1SJohn Levon 	{ "const int", CTF_K_CONST },
2696ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
2706ef284f1SJohn Levon 	{ NULL }
2716ef284f1SJohn Levon };
2726ef284f1SJohn Levon 
2736ef284f1SJohn Levon static check_descent_test_t alt_descents_ptr_to_const_int[] = {
2746ef284f1SJohn Levon 	{ "ptr_to_const_int", check_descent_ptr_to_const_int },
2756ef284f1SJohn Levon 	{ NULL }
2766ef284f1SJohn Levon };
2776ef284f1SJohn Levon 
2786ef284f1SJohn Levon static check_descent_t check_descent_const_ptr_to_int[] = {
2796ef284f1SJohn Levon 	{ "int *const", CTF_K_CONST },
2806ef284f1SJohn Levon 	{ "int *", CTF_K_POINTER },
2816ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
2826ef284f1SJohn Levon 	{ NULL }
2836ef284f1SJohn Levon };
2846ef284f1SJohn Levon 
2856ef284f1SJohn Levon static check_descent_test_t alt_descents_const_ptr_to_int[] = {
2866ef284f1SJohn Levon 	{ "const_ptr_to_int", check_descent_const_ptr_to_int },
2876ef284f1SJohn Levon 	{ NULL }
2886ef284f1SJohn Levon };
2896ef284f1SJohn Levon 
2906ef284f1SJohn Levon static check_descent_t check_descent_const_ptr_to_const_int[] = {
2916ef284f1SJohn Levon 	{ "const int *const", CTF_K_CONST },
2926ef284f1SJohn Levon 	{ "const int *", CTF_K_POINTER },
2936ef284f1SJohn Levon 	{ "const int", CTF_K_CONST },
2946ef284f1SJohn Levon 	{ "int", CTF_K_INTEGER },
2956ef284f1SJohn Levon 	{ NULL }
2966ef284f1SJohn Levon };
2976ef284f1SJohn Levon 
2986ef284f1SJohn Levon static check_descent_test_t alt_descents_const_ptr_to_const_int[] = {
2996ef284f1SJohn Levon 	{ "const_ptr_to_const_int", check_descent_const_ptr_to_const_int },
3006ef284f1SJohn Levon 	{ NULL }
3016ef284f1SJohn Levon };
3026ef284f1SJohn Levon 
3036ef284f1SJohn Levon static check_descent_test_t *alt_descents[] = {
3046ef284f1SJohn Levon 	alt_descents_const_union_array,
3056ef284f1SJohn Levon 	alt_descents_const_struct_array,
3066ef284f1SJohn Levon 	alt_descents_volatile_struct_array,
3076ef284f1SJohn Levon 	alt_descents_c_int_array,
3086ef284f1SJohn Levon 	alt_descents_cv_int_array,
3096ef284f1SJohn Levon 	alt_descents_vc_int_array,
3106ef284f1SJohn Levon 	alt_descents_vc_int_array2,
3116ef284f1SJohn Levon 	alt_descents_c_2d_array,
3126ef284f1SJohn Levon 	alt_descents_cv_3d_array,
3136ef284f1SJohn Levon 	alt_descents_ptr_to_const_int,
3146ef284f1SJohn Levon 	alt_descents_const_ptr_to_int,
3156ef284f1SJohn Levon 	alt_descents_const_ptr_to_const_int,
3166ef284f1SJohn Levon 	NULL
3176ef284f1SJohn Levon };
3186ef284f1SJohn Levon 
3196ef284f1SJohn Levon int
main(int argc,char * argv[])3206ef284f1SJohn Levon main(int argc, char *argv[])
3216ef284f1SJohn Levon {
3226ef284f1SJohn Levon 	int i, ret = 0;
3236ef284f1SJohn Levon 
3246ef284f1SJohn Levon 	if (argc < 2) {
3256ef284f1SJohn Levon 		errx(EXIT_FAILURE, "missing test files");
3266ef284f1SJohn Levon 	}
3276ef284f1SJohn Levon 
3286ef284f1SJohn Levon 	for (i = 1; i < argc; i++) {
3296ef284f1SJohn Levon 		ctf_file_t *fp;
3306ef284f1SJohn Levon 
3316ef284f1SJohn Levon 		if ((fp = ctf_open(argv[i], &ret)) == NULL) {
3326ef284f1SJohn Levon 			warnx("failed to open %s: %s", argv[i],
3336ef284f1SJohn Levon 			    ctf_errmsg(ret));
3346ef284f1SJohn Levon 			ret = EXIT_FAILURE;
3356ef284f1SJohn Levon 			continue;
3366ef284f1SJohn Levon 		}
3376ef284f1SJohn Levon 
3386ef284f1SJohn Levon 		for (uint_t j = 0; alt_descents[j] != NULL; j++) {
3396ef284f1SJohn Levon 			check_descent_test_t *descents = alt_descents[j];
3406ef284f1SJohn Levon 			int alt_ok = 0;
3416ef284f1SJohn Levon 
3426ef284f1SJohn Levon 			for (uint_t k = 0; descents[k].cdt_sym != NULL; k++) {
3436ef284f1SJohn Levon 				if (ctftest_check_descent(descents[k].cdt_sym,
3446ef284f1SJohn Levon 				    fp, descents[k].cdt_tests, B_TRUE)) {
3456ef284f1SJohn Levon 					alt_ok = 1;
3466ef284f1SJohn Levon 					break;
3476ef284f1SJohn Levon 				}
3486ef284f1SJohn Levon 			}
3496ef284f1SJohn Levon 
3506ef284f1SJohn Levon 			if (!alt_ok) {
3516ef284f1SJohn Levon 				warnx("all descents failed for %s",
3526ef284f1SJohn Levon 				    descents[0].cdt_sym);
3536ef284f1SJohn Levon 				ret = EXIT_FAILURE;
3546ef284f1SJohn Levon 			}
3556ef284f1SJohn Levon 		}
3566ef284f1SJohn Levon 
3576ef284f1SJohn Levon 		ctf_close(fp);
3586ef284f1SJohn Levon 	}
3596ef284f1SJohn Levon 
3606ef284f1SJohn Levon 	return (ret);
3616ef284f1SJohn Levon }
362