Print this page
12259 CTF shouldn't assume enum size
*** 8,18 ****
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
! * Copyright 2019, Joyent, Inc.
*/
/*
* Check that we properly handle enums.
*/
--- 8,18 ----
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
! * Copyright 2020 Joyent, Inc.
*/
/*
* Check that we properly handle enums.
*/
*** 99,108 ****
--- 99,116 ----
{ "enum ff10", check_enum_ff10 },
{ "enum chrono", check_enum_chrono },
{ NULL }
};
+ static check_size_test_t size_enums[] = {
+ { "enum char_enum", 1 },
+ { "enum short_enum", 2 },
+ { "enum int_enum", 4 },
+ { "enum ll_enum", 8 },
+ { NULL }
+ };
+
int
main(int argc, char *argv[])
{
int i, ret = 0;
*** 133,142 ****
--- 141,158 ----
if (!ctftest_check_enum(enums[d].cet_type, fp,
enums[d].cet_tests)) {
ret = EXIT_FAILURE;
}
}
+
+ for (d = 0; size_enums[d].cst_name != NULL; d++) {
+ if (!ctftest_check_size(size_enums[d].cst_name,
+ fp, size_enums[d].cst_size)) {
+ ret = EXIT_FAILURE;
+ }
+ }
+
ctf_close(fp);
}
return (ret);