Linux Trace Development
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Cao Ruichuang <create0818@163.com>
Cc: linux-trace-devel@vger.kernel.org,
	Tzvetomir Stoyanov <tz.stoyanov@gmail.com>,
	Emil Thorsoe <ethorsoe@tuxera.com>
Subject: Re: [PATCH 1/2] libtraceevent utest: Handle short reads when reading BTF
Date: Mon, 1 Jun 2026 10:11:48 -0400	[thread overview]
Message-ID: <20260601101148.24e445e5@fedora> (raw)
In-Reply-To: <20260601103750.68805-2-create0818@163.com>

On Mon,  1 Jun 2026 18:37:49 +0800
Cao Ruichuang <create0818@163.com> wrote:

> @@ -532,7 +557,13 @@ static void test_btf_read(void)
>  			close(fd);
>  			return;
>  		}
> -		CU_TEST(read(fd, buf, st.st_size) == st.st_size);
> +		ret = read_full(fd, buf, st.st_size);
> +		CU_TEST(ret == 0);

Nit, can you change this to:

		CU_TEST((ret = read_full(fd, buf, st.st_size)) == 0);

so that if it fails, it doesn't just report "ret == 0" in the failure.

I'm working to make the CU_TEST() more informative on failures.

Thanks,

-- Steve


> +		if (ret < 0) {
> +			free(buf);
> +			close(fd);
> +			return;
> +		}
>  	}

  reply	other threads:[~2026-06-01 14:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01 10:37 [PATCH 0/2] libtraceevent: Fix BTF utest host dependencies Cao Ruichuang
2026-06-01 10:37 ` [PATCH 1/2] libtraceevent utest: Handle short reads when reading BTF Cao Ruichuang
2026-06-01 14:11   ` Steven Rostedt [this message]
2026-06-01 10:37 ` [PATCH 2/2] libtraceevent utest: Avoid host-specific getname_flags output Cao Ruichuang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260601101148.24e445e5@fedora \
    --to=rostedt@goodmis.org \
    --cc=create0818@163.com \
    --cc=ethorsoe@tuxera.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tz.stoyanov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox