Add testcase data argument to all fstest helper functions.

Needed by pooka for puffs fstest support.
This commit is contained in:
njoly 2010-07-13 15:50:31 +00:00
parent c99c5d9840
commit fb13fa89fd
8 changed files with 49 additions and 40 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs.c,v 1.3 2010/07/12 21:37:47 njoly Exp $ */
/* $NetBSD: ext2fs.c,v 1.4 2010/07/13 15:50:31 njoly Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -32,6 +32,7 @@
#include <sys/mount.h>
#include <sys/stat.h>
#include <atf-c.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -49,7 +50,8 @@ struct ext2fstestargs {
};
static int
ext2fs_fstest_newfs(void **buf, const char *image, off_t size)
ext2fs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
off_t size)
{
char cmd[1024];
int res;
@ -88,7 +90,7 @@ ext2fs_fstest_newfs(void **buf, const char *image, off_t size)
}
static int
ext2fs_fstest_delfs(void *buf)
ext2fs_fstest_delfs(const atf_tc_t *tc, void *buf)
{
int res;
struct ext2fstestargs *args = buf;
@ -107,7 +109,7 @@ ext2fs_fstest_delfs(void *buf)
}
static int
ext2fs_fstest_mount(void *buf, const char *path, int flags)
ext2fs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
{
int res;
struct ext2fstestargs *args = buf;
@ -122,7 +124,7 @@ ext2fs_fstest_mount(void *buf, const char *path, int flags)
}
static int
ext2fs_fstest_unmount(const char *path, int flags)
ext2fs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
{
int res;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs.c,v 1.3 2010/07/12 21:37:47 njoly Exp $ */
/* $NetBSD: ffs.c,v 1.4 2010/07/13 15:50:31 njoly Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -32,6 +32,7 @@
#include <sys/mount.h>
#include <sys/stat.h>
#include <atf-c.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -49,7 +50,7 @@ struct ffstestargs {
};
static int
ffs_fstest_newfs(void **buf, const char *image, off_t size)
ffs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image, off_t size)
{
char cmd[1024];
int res;
@ -87,7 +88,7 @@ ffs_fstest_newfs(void **buf, const char *image, off_t size)
}
static int
ffs_fstest_delfs(void *buf)
ffs_fstest_delfs(const atf_tc_t *tc, void *buf)
{
int res;
struct ffstestargs *args = buf;
@ -106,7 +107,7 @@ ffs_fstest_delfs(void *buf)
}
static int
ffs_fstest_mount(void *buf, const char *path, int flags)
ffs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
{
int res;
struct ffstestargs *args = buf;
@ -121,7 +122,7 @@ ffs_fstest_mount(void *buf, const char *path, int flags)
}
static int
ffs_fstest_unmount(const char *path, int flags)
ffs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
{
int res;

View File

@ -1,4 +1,4 @@
/* $NetBSD: h_fsmacros.h,v 1.8 2010/07/13 11:12:19 pooka Exp $ */
/* $NetBSD: h_fsmacros.h,v 1.9 2010/07/13 15:50:31 njoly Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -60,14 +60,14 @@
{ \
void *tmp; \
atf_check_fstype(tc, type); \
if (fs##_fstest_newfs(&tmp, IMGNAME, IMGSIZE) != 0) \
if (fs##_fstest_newfs(tc, &tmp, IMGNAME, IMGSIZE) != 0) \
atf_tc_fail("newfs failed"); \
if (fs##_fstest_mount(tmp, MNTNAME, 0) != 0) \
if (fs##_fstest_mount(tc, tmp, MNTNAME, 0) != 0) \
atf_tc_fail("mount failed"); \
func(tc,MNTNAME); \
if (fs##_fstest_unmount(MNTNAME, 0) != 0) \
if (fs##_fstest_unmount(tc, MNTNAME, 0) != 0) \
atf_tc_fail("unmount failed"); \
if (fs##_fstest_delfs(tmp) != 0) \
if (fs##_fstest_delfs(tc, tmp) != 0) \
atf_tc_fail("delfs failed"); \
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs.c,v 1.5 2010/07/12 21:37:47 njoly Exp $ */
/* $NetBSD: lfs.c,v 1.6 2010/07/13 15:50:31 njoly Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -50,7 +50,7 @@ struct lfstestargs {
};
static int
lfs_fstest_newfs(void **buf, const char *image, off_t size)
lfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image, off_t size)
{
char cmd[1024];
int res;
@ -89,7 +89,7 @@ lfs_fstest_newfs(void **buf, const char *image, off_t size)
}
static int
lfs_fstest_delfs(void *buf)
lfs_fstest_delfs(const atf_tc_t *tc, void *buf)
{
int res;
struct lfstestargs *args = buf;
@ -108,7 +108,7 @@ lfs_fstest_delfs(void *buf)
}
static int
lfs_fstest_mount(void *buf, const char *path, int flags)
lfs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
{
int res;
struct lfstestargs *args = buf;
@ -125,7 +125,7 @@ lfs_fstest_mount(void *buf, const char *path, int flags)
}
static int
lfs_fstest_unmount(const char *path, int flags)
lfs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
{
int res;

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs.c,v 1.3 2010/07/12 21:37:47 njoly Exp $ */
/* $NetBSD: msdosfs.c,v 1.4 2010/07/13 15:50:31 njoly Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -32,6 +32,7 @@
#include <sys/mount.h>
#include <sys/stat.h>
#include <atf-c.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -49,7 +50,8 @@ struct msdosfstestargs {
};
static int
msdosfs_fstest_newfs(void **buf, const char *image, off_t size)
msdosfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
off_t size)
{
char cmd[1024];
int res;
@ -88,7 +90,7 @@ msdosfs_fstest_newfs(void **buf, const char *image, off_t size)
}
static int
msdosfs_fstest_delfs(void *buf)
msdosfs_fstest_delfs(const atf_tc_t *tc, void *buf)
{
int res;
struct msdosfstestargs *args = buf;
@ -107,7 +109,7 @@ msdosfs_fstest_delfs(void *buf)
}
static int
msdosfs_fstest_mount(void *buf, const char *path, int flags)
msdosfs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
{
int res;
struct msdosfstestargs *args = buf;
@ -122,7 +124,7 @@ msdosfs_fstest_mount(void *buf, const char *path, int flags)
}
static int
msdosfs_fstest_unmount(const char *path, int flags)
msdosfs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
{
int res;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysvbfs.c,v 1.3 2010/07/12 21:37:47 njoly Exp $ */
/* $NetBSD: sysvbfs.c,v 1.4 2010/07/13 15:50:31 njoly Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -32,6 +32,7 @@
#include <sys/mount.h>
#include <sys/stat.h>
#include <atf-c.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -49,7 +50,8 @@ struct sysvbfstestargs {
};
static int
sysvbfs_fstest_newfs(void **buf, const char *image, off_t size)
sysvbfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
off_t size)
{
char cmd[1024];
int res;
@ -88,7 +90,7 @@ sysvbfs_fstest_newfs(void **buf, const char *image, off_t size)
}
static int
sysvbfs_fstest_delfs(void *buf)
sysvbfs_fstest_delfs(const atf_tc_t *tc, void *buf)
{
int res;
struct sysvbfstestargs *args = buf;
@ -107,7 +109,7 @@ sysvbfs_fstest_delfs(void *buf)
}
static int
sysvbfs_fstest_mount(void *buf, const char *path, int flags)
sysvbfs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
{
int res;
struct sysvbfstestargs *args = buf;
@ -122,7 +124,7 @@ sysvbfs_fstest_mount(void *buf, const char *path, int flags)
}
static int
sysvbfs_fstest_unmount(const char *path, int flags)
sysvbfs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
{
int res;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tmpfs.c,v 1.3 2010/07/12 21:37:47 njoly Exp $ */
/* $NetBSD: tmpfs.c,v 1.4 2010/07/13 15:50:31 njoly Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -32,6 +32,7 @@
#include <sys/mount.h>
#include <sys/stat.h>
#include <atf-c.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -47,7 +48,8 @@ struct tmpfstestargs {
};
static int
tmpfs_fstest_newfs(void **buf, const char *image, off_t size)
tmpfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
off_t size)
{
int res;
struct tmpfstestargs *args;
@ -70,7 +72,7 @@ tmpfs_fstest_newfs(void **buf, const char *image, off_t size)
}
static int
tmpfs_fstest_delfs(void *buf)
tmpfs_fstest_delfs(const atf_tc_t *tc, void *buf)
{
struct tmpfstestargs *args = buf;
@ -80,7 +82,7 @@ tmpfs_fstest_delfs(void *buf)
}
static int
tmpfs_fstest_mount(void *buf, const char *path, int flags)
tmpfs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
{
int res;
struct tmpfstestargs *args = buf;
@ -95,7 +97,7 @@ tmpfs_fstest_mount(void *buf, const char *path, int flags)
}
static int
tmpfs_fstest_unmount(const char *path, int flags)
tmpfs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
{
int res;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_mount.c,v 1.4 2010/07/13 01:42:21 enami Exp $ */
/* $NetBSD: t_mount.c,v 1.5 2010/07/13 15:50:31 njoly Exp $ */
/*
* Adapted for rump and atf from a testcase supplied
@ -25,19 +25,19 @@ ATF_TC_BODY(48Kimage, tc)
{
void *tmp;
if (ffs_fstest_newfs(&tmp, IMGNAME, IMGSIZE) != 0)
if (ffs_fstest_newfs(tc, &tmp, IMGNAME, IMGSIZE) != 0)
atf_tc_fail("newfs failed");
atf_tc_expect_fail("PR kern/43573");
if (ffs_fstest_mount(tmp, MNTDIR, 0) != 0) {
if (ffs_fstest_mount(tc, tmp, MNTDIR, 0) != 0) {
atf_tc_fail("mount failed");
}
atf_tc_expect_pass();
if (ffs_fstest_unmount(MNTDIR, 0) != 0)
if (ffs_fstest_unmount(tc, MNTDIR, 0) != 0)
atf_tc_fail("unmount failed");
if (ffs_fstest_delfs(tmp) != 0)
if (ffs_fstest_delfs(tc, tmp) != 0)
atf_tc_fail("delfs failed");
}