1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright (c) 2019, Joyent, Inc.
14 */
15
16 /*
17 * Check that we properly generate basic nested arrays.
18 */
19
20 #include "check-common.h"
21
22 static check_number_t check_base[] = {
23 { "char", CTF_K_INTEGER, CTF_INT_SIGNED | CTF_INT_CHAR, 0, 8 },
24 { "int", CTF_K_INTEGER, CTF_INT_SIGNED, 0, 32 },
25 { "double", CTF_K_FLOAT, CTF_FP_DOUBLE, 0, 64 },
26 { NULL }
27 };
28
29 static check_symbol_t check_syms[] = {
30 { "a", "int [3]" },
31 { "b", "double [42]" },
32 { "c", "const char *[2]" },
33 { "d", "int [4][5]" },
88 if (argc < 2) {
89 errx(EXIT_FAILURE, "missing test files");
90 }
91
92 for (i = 1; i < argc; i++) {
93 ctf_file_t *fp;
94 uint_t d;
95
96 if ((fp = ctf_open(argv[i], &ret)) == NULL) {
97 warnx("failed to open %s: %s", argv[i],
98 ctf_errmsg(ret));
99 ret = EXIT_FAILURE;
100 continue;
101 }
102 if (!ctftest_check_numbers(fp, check_base))
103 ret = EXIT_FAILURE;
104 if (!ctftest_check_symbols(fp, check_syms))
105 ret = EXIT_FAILURE;
106 for (d = 0; descents[d].cdt_sym != NULL; d++) {
107 if (!ctftest_check_descent(descents[d].cdt_sym, fp,
108 descents[d].cdt_tests)) {
109 ret = EXIT_FAILURE;
110 }
111 }
112 ctf_close(fp);
113 }
114
115 return (ret);
116 }
|
1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2019, Joyent, Inc.
14 */
15
16 /*
17 * Check that we properly generate basic nested arrays.
18 */
19
20 #include "check-common.h"
21
22 static check_number_t check_base[] = {
23 { "char", CTF_K_INTEGER, CTF_INT_SIGNED | CTF_INT_CHAR, 0, 8 },
24 { "int", CTF_K_INTEGER, CTF_INT_SIGNED, 0, 32 },
25 { "double", CTF_K_FLOAT, CTF_FP_DOUBLE, 0, 64 },
26 { NULL }
27 };
28
29 static check_symbol_t check_syms[] = {
30 { "a", "int [3]" },
31 { "b", "double [42]" },
32 { "c", "const char *[2]" },
33 { "d", "int [4][5]" },
88 if (argc < 2) {
89 errx(EXIT_FAILURE, "missing test files");
90 }
91
92 for (i = 1; i < argc; i++) {
93 ctf_file_t *fp;
94 uint_t d;
95
96 if ((fp = ctf_open(argv[i], &ret)) == NULL) {
97 warnx("failed to open %s: %s", argv[i],
98 ctf_errmsg(ret));
99 ret = EXIT_FAILURE;
100 continue;
101 }
102 if (!ctftest_check_numbers(fp, check_base))
103 ret = EXIT_FAILURE;
104 if (!ctftest_check_symbols(fp, check_syms))
105 ret = EXIT_FAILURE;
106 for (d = 0; descents[d].cdt_sym != NULL; d++) {
107 if (!ctftest_check_descent(descents[d].cdt_sym, fp,
108 descents[d].cdt_tests, B_FALSE)) {
109 ret = EXIT_FAILURE;
110 }
111 }
112 ctf_close(fp);
113 }
114
115 return (ret);
116 }
|