public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v1 1/2] syscalls/fstat{01,02}: rewrote testcases
Date: Tue, 28 May 2019 16:03:35 +0200	[thread overview]
Message-ID: <20190528140334.GA27526@rei> (raw)
In-Reply-To: <20190520055038.11499-1-camann@suse.com>

Hi!
> +++ b/testcases/kernel/syscalls/fstat/fstat.h
> @@ -0,0 +1,34 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) SUSE LLC, 2019
> + * Author: Christian Amann <camann@suse.com>
> + */
> +
> +#ifndef __FSTAT_H__
> +#define __FSTAT_H__
> +
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <unistd.h>
> +#include "lapi/syscalls.h"
> +
> +#define TEST_VARIANTS	2
> +#define TESTFILE	"test_file"
> +
> +static void syscall_info(void)
> +{
> +	if (tst_variant == 0) {
> +		tst_res(TINFO, "Testing libc fstat()");
> +		return;
> +	}
> +	tst_res(TINFO, "Testing syscall fstat()");
> +}
> +
> +static int tst_fstat(int fd, struct stat *statbuf)
> +{
> +	if (tst_variant == 0)
> +		return fstat(fd, statbuf);
> +	return tst_syscall(__NR_fstat, fd, statbuf);
> +}

Have you tested this wrapper with 32bit binary?

Because on x86 (among others) we do have fstat and fstat64 that differ
in the statbuf structure size (see man fstat NOTES). If I add a printf()
to print sizeof(struct stat) to the fstat01.c test on x86 I get 96 bytes
with _FILE_OFFSET_BITS=64 and 88 without, so I guess that this uses
wrong syscall with the _FILE_OFFSET_BITS=64 defined.

And actually there are three fstat variants there, the old_fstat, fstat
and fstat64, we could probably test all three variants but I guess that
old_fstat is actually not worth of the effort...

HINT: You can compile 32bit LTP on 64bit distribution with:
      ./configure CFLAGS=-m32 LDFLAGS=-m32.

-- 
Cyril Hrubis
chrubis@suse.cz

      parent reply	other threads:[~2019-05-28 14:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20  5:50 [LTP] [PATCH v1 1/2] syscalls/fstat{01,02}: rewrote testcases Christian Amann
2019-05-20  5:50 ` [LTP] [PATCH v1 2/2] syscalls/fstat{03,05}: " Christian Amann
2019-05-28 14:03 ` Cyril Hrubis [this message]

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=20190528140334.GA27526@rei \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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