CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
75 lines
2.3 KiB
C
75 lines
2.3 KiB
C
/* Make sure that error returns are correct. Usually this is trivially
|
|
true, but on platforms with unusual type sizes all the casting might
|
|
cause problems with unexpected sign-extension and truncation. */
|
|
|
|
#include <ctf-api.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
ctf_dict_t *fp;
|
|
ctf_next_t *i = NULL;
|
|
size_t boom = 0;
|
|
ctf_id_t itype = 0, stype = 0;
|
|
ctf_encoding_t encoding = {0};
|
|
ctf_membinfo_t mi;
|
|
ssize_t ret;
|
|
int err;
|
|
|
|
if ((fp = ctf_create (&err)) == NULL)
|
|
{
|
|
fprintf (stderr, "%s: cannot create: %s\n", argv[0], ctf_errmsg (err));
|
|
return 1;
|
|
}
|
|
|
|
/* First error class: int return. */
|
|
|
|
if (ctf_member_count (fp, 1024) >= 0)
|
|
fprintf (stderr, "int return: non-error return: %i\n",
|
|
ctf_member_count(fp, 1024));
|
|
|
|
/* Second error class: type ID return. */
|
|
|
|
if (ctf_type_reference (fp, 1024) != CTF_ERR)
|
|
fprintf (stderr, "ctf_id_t return: non-error return: %li\n",
|
|
ctf_type_reference (fp, 1024));
|
|
|
|
/* Third error class: ssize_t return. Create a type to iterate over first. */
|
|
|
|
if ((itype = ctf_add_integer (fp, CTF_ADD_ROOT, "int", &encoding)) == CTF_ERR)
|
|
fprintf (stderr, "cannot add int: %s\n", ctf_errmsg (ctf_errno (fp)));
|
|
else if ((stype = ctf_add_struct (fp, CTF_ADD_ROOT, "foo")) == CTF_ERR)
|
|
fprintf (stderr, "cannot add struct: %s\n", ctf_errmsg (ctf_errno (fp)));
|
|
else if (ctf_add_member (fp, stype, "bar", itype) < 0)
|
|
fprintf (stderr, "cannot add member: %s\n", ctf_errmsg (ctf_errno (fp)));
|
|
|
|
if (ctf_member_info (fp, stype, "bar", &mi) < 0)
|
|
fprintf (stderr, "cannot get member info: %s\n", ctf_errmsg (ctf_errno (fp)));
|
|
|
|
/* Iteration should never produce an offset bigger than the offset just returned,
|
|
and should quickly terminate. */
|
|
|
|
while ((ret = ctf_member_next (fp, stype, &i, NULL, NULL, 0)) >= 0) {
|
|
if (ret > mi.ctm_offset)
|
|
fprintf (stderr, "ssize_t return: unexpected offset: %zi\n", ret);
|
|
if (boom++ > 1000)
|
|
{
|
|
fprintf (stderr, "member iteration went on way too long\n");
|
|
exit (1);
|
|
}
|
|
}
|
|
|
|
/* Fourth error class (trivial): pointer return. */
|
|
if (ctf_type_aname (fp, 1024) != NULL)
|
|
fprintf (stderr, "pointer return: non-error return: %p\n",
|
|
ctf_type_aname (fp, 1024));
|
|
|
|
ctf_file_close (fp);
|
|
|
|
printf("All done.\n");
|
|
|
|
return 0;
|
|
}
|