Fri Jan 7 11:52:59 2011 UTC ()
add another fstype for ffs -o log


(pooka)
diff -r1.2 -r1.3 src/tests/fs/common/fstest_ffs.c
diff -r1.27 -r1.28 src/tests/fs/common/h_fsmacros.h

cvs diff -r1.2 -r1.3 src/tests/fs/common/fstest_ffs.c (expand / switch to unified diff)

--- src/tests/fs/common/fstest_ffs.c 2010/07/30 16:15:05 1.2
+++ src/tests/fs/common/fstest_ffs.c 2011/01/07 11:52:59 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fstest_ffs.c,v 1.2 2010/07/30 16:15:05 pooka Exp $ */ 1/* $NetBSD: fstest_ffs.c,v 1.3 2011/01/07 11:52:59 pooka Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2010 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Nicolas Joly. 8 * by Nicolas Joly.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -79,60 +79,70 @@ ffs_fstest_newfs(const atf_tc_t *tc, voi @@ -79,60 +79,70 @@ ffs_fstest_newfs(const atf_tc_t *tc, voi
79 args->ta_uargs.fspec = args->ta_devpath; 79 args->ta_uargs.fspec = args->ta_devpath;
80 80
81 res = rump_pub_etfs_register(args->ta_devpath, image, RUMP_ETFS_BLK); 81 res = rump_pub_etfs_register(args->ta_devpath, image, RUMP_ETFS_BLK);
82 if (res != 0) { 82 if (res != 0) {
83 free(args); 83 free(args);
84 return res; 84 return res;
85 } 85 }
86 86
87 *buf = args; 87 *buf = args;
88 num++; 88 num++;
89 89
90 return 0; 90 return 0;
91} 91}
 92__strong_alias(ffslog_fstest_newfs,ffs_fstest_newfs);
92 93
93int 94int
94ffs_fstest_delfs(const atf_tc_t *tc, void *buf) 95ffs_fstest_delfs(const atf_tc_t *tc, void *buf)
95{ 96{
96 int res; 97 int res;
97 struct ffstestargs *args = buf; 98 struct ffstestargs *args = buf;
98 99
99 res = rump_pub_etfs_remove(args->ta_devpath); 100 res = rump_pub_etfs_remove(args->ta_devpath);
100 if (res != 0) 101 if (res != 0)
101 return res; 102 return res;
102 103
103 res = unlink(args->ta_imgpath); 104 res = unlink(args->ta_imgpath);
104 if (res != 0) 105 if (res != 0)
105 return res; 106 return res;
106 107
107 free(args); 108 free(args);
108 109
109 return 0; 110 return 0;
110} 111}
 112__strong_alias(ffslog_fstest_delfs,ffs_fstest_delfs);
111 113
112int 114int
113ffs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags) 115ffs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
114{ 116{
115 int res; 117 int res;
116 struct ffstestargs *args = buf; 118 struct ffstestargs *args = buf;
117 119
118 res = rump_sys_mkdir(path, 0777); 120 res = rump_sys_mkdir(path, 0777);
119 if (res == -1) 121 if (res == -1)
120 return res; 122 return res;
121 123
122 res = rump_sys_mount(MOUNT_FFS, path, flags, &args->ta_uargs, 124 res = rump_sys_mount(MOUNT_FFS, path, flags, &args->ta_uargs,
123 sizeof(args->ta_uargs)); 125 sizeof(args->ta_uargs));
124 return res; 126 return res;
125} 127}
126 128
127int 129int
 130ffslog_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
 131{
 132
 133 return ffs_fstest_mount(tc, buf, path, flags | MNT_LOG);
 134}
 135
 136int
128ffs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags) 137ffs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
129{ 138{
130 int res; 139 int res;
131 140
132 res = rump_sys_unmount(path, flags); 141 res = rump_sys_unmount(path, flags);
133 if (res == -1) 142 if (res == -1)
134 return res; 143 return res;
135 144
136 res = rump_sys_rmdir(path); 145 res = rump_sys_rmdir(path);
137 return res; 146 return res;
138} 147}
 148__strong_alias(ffslog_fstest_unmount,ffs_fstest_unmount);

cvs diff -r1.27 -r1.28 src/tests/fs/common/h_fsmacros.h (expand / switch to unified diff)

--- src/tests/fs/common/h_fsmacros.h 2011/01/07 11:41:40 1.27
+++ src/tests/fs/common/h_fsmacros.h 2011/01/07 11:52:59 1.28
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: h_fsmacros.h,v 1.27 2011/01/07 11:41:40 pooka Exp $ */ 1/* $NetBSD: h_fsmacros.h,v 1.28 2011/01/07 11:52:59 pooka Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2010 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Nicolas Joly. 8 * by Nicolas Joly.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -41,26 +41,27 @@ @@ -41,26 +41,27 @@
41#include <rump/rump.h> 41#include <rump/rump.h>
42 42
43#include "../../h_macros.h" 43#include "../../h_macros.h"
44 44
45#define FSPROTOS(_fs_) \ 45#define FSPROTOS(_fs_) \
46int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *, \ 46int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *, \
47 off_t, void *); \ 47 off_t, void *); \
48int _fs_##_fstest_delfs(const atf_tc_t *, void *); \ 48int _fs_##_fstest_delfs(const atf_tc_t *, void *); \
49int _fs_##_fstest_mount(const atf_tc_t *, void *, const char *, int); \ 49int _fs_##_fstest_mount(const atf_tc_t *, void *, const char *, int); \
50int _fs_##_fstest_unmount(const atf_tc_t *, const char *, int); 50int _fs_##_fstest_unmount(const atf_tc_t *, const char *, int);
51 51
52FSPROTOS(ext2fs); 52FSPROTOS(ext2fs);
53FSPROTOS(ffs); 53FSPROTOS(ffs);
 54FSPROTOS(ffslog);
54FSPROTOS(lfs); 55FSPROTOS(lfs);
55FSPROTOS(msdosfs); 56FSPROTOS(msdosfs);
56FSPROTOS(nfs); 57FSPROTOS(nfs);
57FSPROTOS(nfsro); 58FSPROTOS(nfsro);
58FSPROTOS(p2k_ffs); 59FSPROTOS(p2k_ffs);
59FSPROTOS(puffs); 60FSPROTOS(puffs);
60FSPROTOS(rumpfs); 61FSPROTOS(rumpfs);
61FSPROTOS(sysvbfs); 62FSPROTOS(sysvbfs);
62FSPROTOS(tmpfs); 63FSPROTOS(tmpfs);
63 64
64#ifndef FSTEST_IMGNAME 65#ifndef FSTEST_IMGNAME
65#define FSTEST_IMGNAME "image.fs" 66#define FSTEST_IMGNAME "image.fs"
66#endif 67#endif
@@ -159,69 +160,73 @@ do { \ @@ -159,69 +160,73 @@ do { \
159 { \ 160 { \
160 if (!atf_check_fstype(tc, _type_)) \ 161 if (!atf_check_fstype(tc, _type_)) \
161 return; \ 162 return; \
162 if (_fs_##_fstest_delfs(tc, _fs_##_func_##tmp) != 0) \ 163 if (_fs_##_fstest_delfs(tc, _fs_##_func_##tmp) != 0) \
163 atf_tc_fail_errno("delfs failed"); \ 164 atf_tc_fail_errno("delfs failed"); \
164 } 165 }
165 166
166#define ATF_TP_FSADD(fs,func) \ 167#define ATF_TP_FSADD(fs,func) \
167 ATF_TP_ADD_TC(tp,fs##_##func) 168 ATF_TP_ADD_TC(tp,fs##_##func)
168 169
169#define ATF_TC_FSAPPLY(func,desc) \ 170#define ATF_TC_FSAPPLY(func,desc) \
170 ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc) \ 171 ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc) \
171 ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc) \ 172 ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc) \
 173 ATF_TC_FSADD(ffslog,MOUNT_FFS,func,desc) \
172 ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc) \ 174 ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc) \
173 ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \ 175 ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \
174 ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc) \ 176 ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc) \
175 ATF_TC_FSADD(p2k_ffs,MOUNT_PUFFS,func,desc) \ 177 ATF_TC_FSADD(p2k_ffs,MOUNT_PUFFS,func,desc) \
176 ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc) \ 178 ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc) \
177 ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc) \ 179 ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc) \
178 ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \ 180 ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \
179 ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc) 181 ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)
180 182
181#define ATF_TP_FSAPPLY(func) \ 183#define ATF_TP_FSAPPLY(func) \
182 ATF_TP_FSADD(ext2fs,func); \ 184 ATF_TP_FSADD(ext2fs,func); \
183 ATF_TP_FSADD(ffs,func); \ 185 ATF_TP_FSADD(ffs,func); \
 186 ATF_TP_FSADD(ffslog,func); \
184 ATF_TP_FSADD(lfs,func); \ 187 ATF_TP_FSADD(lfs,func); \
185 ATF_TP_FSADD(msdosfs,func); \ 188 ATF_TP_FSADD(msdosfs,func); \
186 ATF_TP_FSADD(nfs,func); \ 189 ATF_TP_FSADD(nfs,func); \
187 ATF_TP_FSADD(p2k_ffs,func); \ 190 ATF_TP_FSADD(p2k_ffs,func); \
188 ATF_TP_FSADD(puffs,func); \ 191 ATF_TP_FSADD(puffs,func); \
189 ATF_TP_FSADD(rumpfs,func); \ 192 ATF_TP_FSADD(rumpfs,func); \
190 ATF_TP_FSADD(sysvbfs,func); \ 193 ATF_TP_FSADD(sysvbfs,func); \
191 ATF_TP_FSADD(tmpfs,func); 194 ATF_TP_FSADD(tmpfs,func);
192 195
193/* 196/*
194 * Same as above, but generate a file system image first and perform 197 * Same as above, but generate a file system image first and perform
195 * tests for a r/o mount. 198 * tests for a r/o mount.
196 * 199 *
197 * Missing the following file systems: 200 * Missing the following file systems:
198 * + lfs (fstest_lfs routines cannot handle remount. FIXME!) 201 * + lfs (fstest_lfs routines cannot handle remount. FIXME!)
199 * + tmpfs (memory backend) 202 * + tmpfs (memory backend)
200 * + rumpfs (memory backend) 203 * + rumpfs (memory backend)
201 * + puffs (memory backend, but could be run in theory) 204 * + puffs (memory backend, but could be run in theory)
202 */ 205 */
203 206
204#define ATF_TC_FSAPPLY_RO(func,desc,gen) \ 207#define ATF_TC_FSAPPLY_RO(func,desc,gen) \
205 ATF_TC_FSADD_RO(ext2fs,MOUNT_EXT2FS,func,desc,gen) \ 208 ATF_TC_FSADD_RO(ext2fs,MOUNT_EXT2FS,func,desc,gen) \
206 ATF_TC_FSADD_RO(ffs,MOUNT_FFS,func,desc,gen) \ 209 ATF_TC_FSADD_RO(ffs,MOUNT_FFS,func,desc,gen) \
 210 ATF_TC_FSADD_RO(ffslog,MOUNT_FFS,func,desc,gen) \
207 ATF_TC_FSADD_RO(msdosfs,MOUNT_MSDOS,func,desc,gen) \ 211 ATF_TC_FSADD_RO(msdosfs,MOUNT_MSDOS,func,desc,gen) \
208 ATF_TC_FSADD_RO(nfs,MOUNT_NFS,func,desc,gen) \ 212 ATF_TC_FSADD_RO(nfs,MOUNT_NFS,func,desc,gen) \
209 ATF_TC_FSADD_RO(nfsro,MOUNT_NFS,func,desc,gen) \ 213 ATF_TC_FSADD_RO(nfsro,MOUNT_NFS,func,desc,gen) \
210 ATF_TC_FSADD_RO(sysvbfs,MOUNT_SYSVBFS,func,desc,gen) 214 ATF_TC_FSADD_RO(sysvbfs,MOUNT_SYSVBFS,func,desc,gen)
211 215
212#define ATF_TP_FSAPPLY_RO(func) \ 216#define ATF_TP_FSAPPLY_RO(func) \
213 ATF_TP_FSADD(ext2fs,func); \ 217 ATF_TP_FSADD(ext2fs,func); \
214 ATF_TP_FSADD(ffs,func); \ 218 ATF_TP_FSADD(ffs,func); \
 219 ATF_TP_FSADD(ffslog,func); \
215 ATF_TP_FSADD(msdosfs,func); \ 220 ATF_TP_FSADD(msdosfs,func); \
216 ATF_TP_FSADD(nfs,func); \ 221 ATF_TP_FSADD(nfs,func); \
217 ATF_TP_FSADD(nfsro,func); \ 222 ATF_TP_FSADD(nfsro,func); \
218 ATF_TP_FSADD(sysvbfs,func); 223 ATF_TP_FSADD(sysvbfs,func);
219 224
220#define ATF_FSAPPLY(func,desc) \ 225#define ATF_FSAPPLY(func,desc) \
221 ATF_TC_FSAPPLY(func,desc); \ 226 ATF_TC_FSAPPLY(func,desc); \
222 ATF_TP_ADD_TCS(tp) \ 227 ATF_TP_ADD_TCS(tp) \
223 { \ 228 { \
224 ATF_TP_FSAPPLY(func); \ 229 ATF_TP_FSAPPLY(func); \
225 return atf_no_error(); \ 230 return atf_no_error(); \
226 } 231 }
227 232
@@ -233,26 +238,28 @@ atf_check_fstype(const atf_tc_t *tc, con @@ -233,26 +238,28 @@ atf_check_fstype(const atf_tc_t *tc, con
233 if (!atf_tc_has_config_var(tc, "fstype")) 238 if (!atf_tc_has_config_var(tc, "fstype"))
234 return true; 239 return true;
235 240
236 fstype = atf_tc_get_config_var(tc, "fstype"); 241 fstype = atf_tc_get_config_var(tc, "fstype");
237 if (strcmp(fstype, fs) == 0) 242 if (strcmp(fstype, fs) == 0)
238 return true; 243 return true;
239 return false; 244 return false;
240} 245}
241 246
242#define FSTYPE_EXT2FS(tc)\ 247#define FSTYPE_EXT2FS(tc)\
243 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ext2fs") == 0) 248 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ext2fs") == 0)
244#define FSTYPE_FFS(tc)\ 249#define FSTYPE_FFS(tc)\
245 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ffs") == 0) 250 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ffs") == 0)
 251#define FSTYPE_FFSLOG(tc)\
 252 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ffs") == 0)
246#define FSTYPE_LFS(tc)\ 253#define FSTYPE_LFS(tc)\
247 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "lfs") == 0) 254 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "lfs") == 0)
248#define FSTYPE_MSDOS(tc)\ 255#define FSTYPE_MSDOS(tc)\
249 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "msdosfs") == 0) 256 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "msdosfs") == 0)
250#define FSTYPE_NFS(tc)\ 257#define FSTYPE_NFS(tc)\
251 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfs") == 0) 258 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfs") == 0)
252#define FSTYPE_NFSRO(tc)\ 259#define FSTYPE_NFSRO(tc)\
253 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfsro") == 0) 260 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfsro") == 0)
254#define FSTYPE_P2K_FFS(tc)\ 261#define FSTYPE_P2K_FFS(tc)\
255 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "p2k_ffs") == 0) 262 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "p2k_ffs") == 0)
256#define FSTYPE_PUFFS(tc)\ 263#define FSTYPE_PUFFS(tc)\
257 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "puffs") == 0) 264 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "puffs") == 0)
258#define FSTYPE_RUMPFS(tc)\ 265#define FSTYPE_RUMPFS(tc)\