Back to index

im-sdk  12.3.91
fop_test_case.c
Go to the documentation of this file.
00001 /*
00002  * fop_test_case.c: iml file operation - test cases
00003  */
00004 
00005 #include <stdio.h>
00006 #include <fcntl.h>
00007 #include <unistd.h>
00008 #include <stdlib.h>
00009 #include <string.h>
00010 #include <sys/stat.h>
00011 #include <sys/types.h>
00012 #include <limits.h>
00013 #include <errno.h>
00014 #include <utime.h>
00015 
00016 #include "iml_fop.h"
00017 #include "fop_test.h"
00018 
00019 iml__fopc_create_t   fop__fopc_create;
00020 iml__fopc_free_t     fop__fopc_free;
00021 
00022 iml_fop_open_t              fop_open;
00023 iml_fop_read_t              fop_read;
00024 #if 0
00025 iml_fop_readv_t             fop_readv;
00026 #endif
00027 iml_fop_write_t             fop_write;
00028 #if 0
00029 iml_fop_writev_t     fop_writev;
00030 #endif
00031 iml_fop_close_t             fop_close;
00032 iml_fop_creat_t             fop_creat;
00033 
00034 iml_fop_lseek_t             fop_lseek;
00035 
00036 iml_fop_stat_t              fop_stat;
00037 iml_fop_lstat_t             fop_lstat;
00038 iml_fop_fstat_t             fop_fstat;
00039 
00040 iml_fop_mkdir_t             fop_mkdir;
00041 iml_fop_rmdir_t             fop_rmdir;
00042 
00043 iml_fop_symlink_t    fop_symlink;
00044 iml_fop_readlink_t   fop_readlink;
00045 iml_fop_link_t              fop_link;
00046 iml_fop_unlink_t     fop_unlink;
00047 iml_fop_rename_t     fop_rename;
00048 
00049 iml_fop_fcntl_t             fop_fcntl;
00050 iml_fop_truncate_t   fop_truncate;
00051 iml_fop_ftruncate_t  fop_ftruncate;
00052 
00053 iml_fop_opendir_t    fop_opendir;
00054 iml_fop_readdir_t    fop_readdir;
00055 iml_fop_closedir_t   fop_closedir;
00056 
00057 iml_fop_access_t     fop_access;
00058 iml_fop_chmod_t             fop_chmod;
00059 iml_fop_fchmod_t     fop_fchmod;
00060 iml_fop_chown_t             fop_chown;
00061 iml_fop_lchown_t     fop_lchown;
00062 iml_fop_fchown_t     fop_fchown;
00063 #if 0
00064 iml_fop_fpathconf_t  fop_fpathconf;
00065 iml_fop_pathconf_t   fop_pathconf;
00066 #endif
00067 iml_fop_utime_t             fop_utime;
00068 iml_fop_utimes_t     fop_utimes;
00069 
00070 #define BASEDIR             "/var/lib/iiim/le/fop_test"
00071 #define TEST_DIR     "/var/lib/iiim/le/fop_test/dir"
00072 
00073 #define TEST_FILE1   "/var/lib/iiim/le/fop_test/dir/test_file1"
00074 #define TEST_FILE2   "/var/lib/iiim/le/fop_test/dir/test_file2"
00075 #define TEST_SYMLINK "test_file1"
00076 
00077 #define TEST_DIR_FILE1      "/var/lib/iiim/le/fop_test/dir/test_dir1/fiiiileeee1"
00078 #define TEST_DIR_FILE2      "/var/lib/iiim/le/fop_test/dir/test_dir1/f2"
00079 
00080 #define TEST_DIR1    "/var/lib/iiim/le/fop_test/dir/test_dir1"
00081 #define ABC          "abcdefghijklmnopqrstuvwxyz"
00082 
00083 #if !defined(S_IAMB)
00084 #define S_IAMB       0x1FF
00085 #endif /* !S_IAMB */
00086 
00087 
00088 void
00089 test_prep(void * fopc)
00090 {
00091     DIR *            dirp;
00092     struct dirent *  de;
00093     struct stat             st;
00094     char             path[PATH_MAX];
00095 
00096     umask(0);
00097 
00098     fop_mkdir(fopc, BASEDIR, 0777);
00099     dirp = fop_opendir(fopc, BASEDIR);
00100     while (NULL != (de = fop_readdir(fopc, dirp))) {
00101        if ((0 == strcmp(".", de->d_name)) ||
00102            (0 == strcmp("..", de->d_name))) {
00103            continue;
00104        }
00105        snprintf(path, sizeof (path), "%s/%s", BASEDIR, de->d_name);
00106        fop_stat(fopc, path, &st);
00107        if (0 == S_ISDIR(st.st_mode)) {
00108            fop_unlink(fopc, path);
00109        } else {
00110            fop_rmdir(fopc, path);
00111        }
00112     }
00113     fop_mkdir(fopc, TEST_DIR, 0777);
00114 }
00115 
00116 
00117 void
00118 test_open(void * fopc)
00119 {
00120     int              fd;
00121     struct stat      st;
00122 
00123     fprintf(stderr, "open: ");
00124     fd = fop_open(fopc, TEST_FILE1, O_RDWR);
00125     if (0 <= fd) {
00126        fprintf(stderr, "fail: open should fail on non-existent file\n");
00127        fop_close(fopc, fd);
00128        return;
00129     }
00130 
00131     fd = fop_open(fopc, TEST_FILE1, O_RDWR | O_CREAT | O_TRUNC, 0612);
00132     if (fd < 0) {
00133        fprintf(stderr, "fail: open should succeed: %d %d\n", fd, errno);
00134        return;
00135     }
00136     fop_close(fopc, fd);
00137 
00138     if (fop_stat(fopc, TEST_FILE1, &st) < 0) {
00139        fprintf(stderr, "fail: %s does not exist: %d\n", TEST_FILE1, errno);
00140        return;
00141     } else {
00142        if (0612 != (S_IAMB & st.st_mode)) {
00143            fprintf(stderr, "fail: mode error: 0%3o\n", (S_IAMB & st.st_mode));
00144            return;
00145        }
00146     }
00147 
00148     fd = fop_open(fopc, TEST_FILE1, O_RDWR);
00149     if (fd < 0) {
00150        fprintf(stderr, "fail: open should succeed (o_RDWR)\n");
00151        return;
00152     }
00153     fop_close(fopc, fd);
00154 
00155     fprintf(stderr, "succeed\n");
00156 }
00157 
00158 
00159 void
00160 test_read(void * fopc)
00161 {
00162     char      buf[1024];
00163     int              fd;
00164     int              rv;
00165 
00166     fprintf(stderr, "read: ");
00167 
00168     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0777);
00169     fop_write(fopc, fd, "hogera", 7);
00170     fop_close(fopc, fd);
00171 
00172     memset(buf, 0, sizeof (buf));
00173     fd = fop_open(fopc, TEST_FILE1, O_RDONLY);
00174     rv = fop_read(fopc, fd, buf, sizeof (buf));
00175     fop_close(fopc, fd);
00176 
00177     if (7 != rv) {
00178        fprintf(stderr, "fail - read length error\n");
00179        return;
00180     }
00181 
00182     if (0 != memcmp(buf, "hogera", 7)) {
00183        fprintf(stderr, "fail - incorrect contents\n");
00184        return;
00185     }
00186 
00187     fprintf(stderr, "succeed\n");
00188 }
00189 
00190 
00191 #if 0
00192 void
00193 test_readv(void * fopc)
00194 {
00195     fprintf(stderr, "readv: ");
00196     fprintf(stderr, "succeed\n");
00197 }
00198 #endif
00199 
00200 void
00201 test_write(void * fopc)
00202 {
00203     char      buf[1024];
00204     int              fd;
00205     int              rv;
00206 
00207     fprintf(stderr, "write: ");
00208 
00209     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0777);
00210 
00211     rv = fop_write(fopc, fd, "hogera", 7);
00212     fop_close(fopc, fd);
00213     if (7 != rv) {
00214        fprintf(stderr, "fail - write length error\n");
00215        return;
00216     }
00217 
00218 
00219     memset(buf, 0, sizeof (buf));
00220     fd = fop_open(fopc, TEST_FILE1, O_RDONLY);
00221     rv = fop_read(fopc, fd, buf, sizeof (buf));
00222     fop_close(fopc, fd);
00223 
00224     if (0 != memcmp(buf, "hogera", 7)) {
00225        fprintf(stderr, "fail - incorrect contents\n");
00226        return;
00227     }
00228 
00229      fprintf(stderr, "succeed\n");
00230 }
00231 
00232 
00233 #if 0
00234 void
00235 test_writev(void * fopc)
00236 {
00237     fprintf(stderr, "writev: ");
00238     fprintf(stderr, "succeed\n");
00239 }
00240 #endif
00241 
00242 
00243 void
00244 test_close(void * fopc)
00245 {
00246     int       fd;
00247     int       rv;
00248 
00249     fprintf(stderr, "close: ");
00250 
00251     fd = fop_open(fopc, TEST_FILE1, O_RDWR | O_CREAT | O_TRUNC, 0777);
00252 
00253     rv = fop_close(fopc, fd);
00254     if (rv < 0) {
00255        fprintf(stderr, "fail - close error");
00256        return;
00257     }
00258 
00259     fd = fop_open(fopc, TEST_FILE1, O_RDWR | O_CREAT | O_TRUNC, 0777);
00260 
00261     rv = fop_close(fopc, fd + 5);
00262     (void)fop_close(fopc, fd);
00263     if (0 <= rv) {
00264        fprintf(stderr, "fail - close should fail");
00265        return;
00266     }
00267 
00268     fprintf(stderr, "succeed\n");
00269 }
00270 
00271 
00272 void
00273 test_creat(void * fopc)
00274 {
00275     int              fd;
00276     struct stat      st;
00277 
00278     fprintf(stderr, "creat: ");
00279 
00280     if (0 == fop_stat(fopc, TEST_FILE1, &st)) {
00281        fop_unlink(fopc, TEST_FILE1);
00282        if (0 == fop_stat(fopc, TEST_FILE1, &st)) {
00283            fprintf(stderr, "fail: can not remove %s\n", TEST_FILE1);
00284            return;
00285        }
00286     }
00287 
00288     fd = fop_creat(fopc, TEST_FILE1, 0700);
00289     if (fd < 0) {
00290        fprintf(stderr, "fail: open should succeed\n");
00291        return;
00292     }
00293 
00294     if (fop_stat(fopc, TEST_FILE1, &st) < 0) {
00295        fprintf(stderr, "fail: %s does not exist\n", TEST_FILE1);
00296        return;
00297     } else {
00298        if (0700 != (S_IAMB & st.st_mode)) {
00299            fprintf(stderr, "fail: mode error: %04o\n", st.st_mode);
00300            return;
00301        }
00302     }
00303 
00304     fop_unlink(fopc, TEST_FILE1);
00305 
00306     fprintf(stderr, "succeed\n");
00307 }
00308 
00309 
00310 void
00311 test_lseek(void * fopc)
00312 {
00313     int              fd;
00314     char      buf[26];
00315 
00316     fprintf(stderr, "lseek: ");
00317 
00318     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0666);
00319     fop_write(fopc, fd, ABC, 26);
00320     fop_close(fopc, fd);
00321 
00322     fd = fop_open(fopc, TEST_FILE1, O_RDONLY);
00323     fop_lseek(fopc, fd, 3, SEEK_SET);
00324     fop_read(fopc, fd, buf, 1);
00325     if ('d' != buf[0]) {
00326        fprintf(stderr, "fail: SEEK_SET not working\n");
00327        return;
00328     }
00329     fop_lseek(fopc, fd, 3, SEEK_CUR);
00330     fop_read(fopc, fd, buf, 1);
00331     if ('h' != buf[0]) {
00332        fprintf(stderr, "fail: SEEK_CUR not working\n");
00333        return;
00334     }
00335     fop_lseek(fopc, fd, -3, SEEK_END);
00336     fop_read(fopc, fd, buf, 1);
00337     if ('x' != buf[0]) {
00338        fprintf(stderr, "fail: SEEK_END not working\n");
00339        return;
00340     }
00341 
00342     fop_close(fopc, fd);
00343     fop_unlink(fopc, TEST_FILE1);
00344 
00345     fprintf(stderr, "succeed\n");
00346 }
00347 
00348 
00349 void
00350 test_stat(void * fopc)
00351 {
00352     int              fd;
00353     struct stat      st;
00354 
00355     fprintf(stderr, "stat: ");
00356 
00357     if (0 == fop_stat(fopc, TEST_FILE1, &st)) {
00358        fprintf(stderr, "fail: stat should fail on none-existent file\n");
00359        return;
00360     }
00361 
00362     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00363     fop_write(fopc, fd, "data", 4);
00364     fop_close(fopc, fd);
00365 
00366     if (0 != fop_stat(fopc, TEST_FILE1, &st)) {
00367        fprintf(stderr, "fail: stat should succeed\n");
00368        return;
00369     }
00370 
00371     if ((0655 != (S_IAMB & st.st_mode)) ||
00372        (geteuid() != st.st_uid) ||
00373        (4 != st.st_size)) {
00374        fprintf(stderr,
00375               "fail: (0655 != %d) || (geteuid() != %d) || (4 != %lu))\n",
00376               st.st_mode, st.st_uid, (unsigned long)st.st_size);
00377        return;
00378     }
00379     
00380     fop_unlink(fopc, TEST_FILE1);
00381     fprintf(stderr, "succeed\n");
00382 }
00383 
00384 
00385 void
00386 test_lstat(void * fopc)
00387 {
00388     int              fd;
00389     struct stat      st;
00390 
00391     fprintf(stderr, "lstat: ");
00392 
00393     if (0 == fop_lstat(fopc, TEST_FILE1, &st)) {
00394        fprintf(stderr, "fail: lstat should fail on none-existent file\n");
00395        return;
00396     }
00397 
00398     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00399     fop_write(fopc, fd, "data", 4);
00400     fop_close(fopc, fd);
00401 
00402     if (0 != fop_lstat(fopc, TEST_FILE1, &st)) {
00403        fprintf(stderr, "fail: lstat should succeed\n");
00404        return;
00405     }
00406 
00407     if ((0655 != (S_IAMB & st.st_mode)) ||
00408        (geteuid() != st.st_uid) ||
00409        (4 != st.st_size)) {
00410        fprintf(stderr,
00411               "fail: (0655 != %d) || (geteuid() != %d) || (4 != %lu))\n",
00412               (S_IAMB & st.st_mode), st.st_uid, (unsigned long)st.st_size);
00413        return;
00414     }
00415     
00416     fop_unlink(fopc, TEST_FILE1);
00417     fprintf(stderr, "succeed\n");
00418 }
00419 
00420 
00421 void
00422 test_fstat(void * fopc)
00423 {
00424     int              fd;
00425     struct stat      st;
00426     int              rv;
00427 
00428     fprintf(stderr, "fstat: ");
00429 
00430     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00431     fop_write(fopc, fd, "data", 4);
00432 
00433     rv = fop_fstat(fopc, fd, &st);
00434     fop_close(fopc, fd);
00435     fop_unlink(fopc, TEST_FILE1);
00436 
00437     if (0 != rv) {
00438        fprintf(stderr, "fail: fstat should succeed\n");
00439        return;
00440     }
00441 
00442     if ((0655 != (S_IAMB & st.st_mode)) ||
00443        (geteuid() != st.st_uid) ||
00444        (4 != st.st_size)) {
00445        fprintf(stderr,
00446               "fail: (0655 != %d) || (geteuid() != %d) || (4 != %lu))\n",
00447               (S_IAMB & st.st_mode), st.st_uid, (unsigned long)st.st_size);
00448        return;
00449     }
00450     
00451     fprintf(stderr, "succeed\n");
00452 }
00453 
00454 
00455 void
00456 test_mkkdir(void * fopc)
00457 {
00458     struct stat      st;
00459 
00460     fprintf(stderr, "mkkdir: ");
00461 
00462     if (0 == fop_stat(fopc, TEST_DIR1, &st)) {
00463        fop_rmdir(fopc, TEST_DIR1);
00464     }
00465 
00466     fop_mkdir(fopc, TEST_DIR1, 0711);
00467     fop_stat(fopc, TEST_DIR1, &st);
00468     fop_rmdir(fopc, TEST_DIR1);
00469 
00470     if (0 == S_ISDIR(st.st_mode)) {
00471        fprintf(stderr, "fail: not a directory\n");
00472        return;
00473     } else if (0711 != (S_IAMB & st.st_mode)) {
00474        fprintf(stderr,
00475               "fail: incorrect permission: %04o\n", (S_IAMB & st.st_mode));
00476        return;
00477     } else if (getuid() != st.st_uid) {
00478        fprintf(stderr, "fail: incorrect uid: %d\n", st.st_uid);
00479        return;
00480     }
00481 
00482     fprintf(stderr, "succeed\n");
00483 }
00484 
00485 
00486 void
00487 test_rmdir(void * fopc)
00488 {
00489     int              rv;
00490     struct stat      st;
00491 
00492     fprintf(stderr, "rmdir: ");
00493 
00494     rv = fop_rmdir(fopc, TEST_DIR1);
00495     if (0 == rv) {
00496        fprintf(stderr, "fail: rmdir should fail on non-existent directory\n");
00497        return;
00498     } else if (ENOENT != errno) {
00499        fprintf(stderr, "fail: errno should be ENOENT\n");
00500        return;
00501     }
00502 
00503     fop_mkdir(fopc, TEST_DIR1, 0711);
00504     rv = fop_rmdir(fopc, TEST_DIR1);
00505     if (rv < 0) {
00506        fprintf(stderr, "fail: errno should succeed\n");
00507        return;
00508     }
00509     if (0 == fop_stat(fopc, TEST_DIR1, &st)) {
00510        fprintf(stderr, "fail: %s exists\n", TEST_DIR1);
00511        return;
00512     }
00513 
00514     fprintf(stderr, "succeed\n");
00515 }
00516 
00517 
00518 void
00519 test_symlink(void * fopc)
00520 {
00521     int              fd;
00522     struct stat      st;
00523 
00524     fprintf(stderr, "symlink: ");
00525 
00526     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00527     fop_close(fopc, fd);
00528 
00529     if (0 != fop_symlink(fopc, TEST_SYMLINK, TEST_FILE2)) {
00530        fprintf(stderr, "fail: symlink failed\n");
00531        fop_unlink(fopc, TEST_FILE1);
00532        return;
00533     }
00534 
00535     if (0 != fop_stat(fopc, TEST_FILE2, &st)) {
00536        fprintf(stderr, "fail: stat on %s\n", TEST_FILE2);
00537     } else if (0 != fop_lstat(fopc, TEST_FILE2, &st)) {
00538        fprintf(stderr, "fail: lstat on %s\n", TEST_FILE2);
00539     } else if (0 == S_ISLNK(st.st_mode)) {
00540        fprintf(stderr, "fail: %s is not a symbolic link\n", TEST_FILE2);
00541     } else {
00542        fprintf(stderr, "succeed\n");
00543     }
00544 
00545     fop_unlink(fopc, TEST_FILE1);
00546     fop_unlink(fopc, TEST_FILE2);
00547 }
00548 
00549 
00550 void
00551 test_readink(void * fopc)
00552 {
00553     int              rv;
00554     char      buf[1024];
00555 
00556     fprintf(stderr, "readlink: ");
00557 
00558     if (0 != fop_symlink(fopc, "symbolic link", TEST_FILE1)) {
00559        fprintf(stderr, "fail: symlink failed\n");
00560        return;
00561     }
00562 
00563     rv = fop_readlink(fopc, TEST_FILE1, buf, sizeof (buf));
00564     fop_unlink(fopc, TEST_FILE1);
00565 
00566     if (0 < rv) {
00567        fprintf(stderr, "fail: readlink failed\n");
00568     } else if (0 != strcmp("symlink link", buf)) {
00569        fprintf(stderr,
00570               "fail: contents error \"%s\" != \"%s\"\n",
00571               "symlink link", buf);
00572     }
00573 
00574     return;
00575 }
00576 
00577 
00578 void
00579 test_link(void * fopc)
00580 {
00581     int              fd;
00582     int              rv;
00583     struct stat      st;
00584 
00585     fprintf(stderr, "link: ");
00586 
00587     rv = fop_link(fopc, TEST_FILE1, TEST_FILE2);
00588     if (0 == rv) {
00589        fprintf(stderr, "error: link should fail\n");
00590        return;
00591     }
00592 
00593     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00594     fop_close(fopc, fd);
00595 
00596     rv = fop_link(fopc, TEST_FILE1, TEST_FILE2);
00597     if (0 != rv) {
00598        fprintf(stderr, "error: link should succeed\n");
00599        return;
00600     }
00601 
00602     fop_unlink(fopc, TEST_FILE1);
00603 
00604     if (0 != fop_stat(fopc, TEST_FILE2, &st)) {
00605        fprintf(stderr, "fail: stat on %s\n", TEST_FILE2);
00606     } else {
00607        fprintf(stderr, "succeed\n");
00608     }
00609 
00610     fop_unlink(fopc, TEST_FILE2);
00611 }
00612 
00613 
00614 void
00615 test_unlink(void * fopc)
00616 {
00617     int              fd;
00618     int              rv;
00619 
00620     fprintf(stderr, "unlink: ");
00621 
00622     rv = fop_unlink(fopc, TEST_FILE1);
00623     if (0 == rv) {
00624        fprintf(stderr, "error: unlink should fail\n");
00625        return;
00626     } else if (ENOENT != errno) {
00627        fprintf(stderr, "error: errno should be ENOENT\n");
00628     }
00629 
00630     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00631     fop_close(fopc, fd);
00632 
00633     rv = fop_unlink(fopc, TEST_FILE1);
00634     if (0 != rv) {
00635        fprintf(stderr, "error: unlink should succeed\n");
00636        return;
00637     }
00638 
00639     fprintf(stderr, "succeed\n");
00640 }
00641 
00642 
00643 void
00644 test_rename(void * fopc)
00645 {
00646     int              fd;
00647     int              rv;
00648     struct stat      st;
00649 
00650     fprintf(stderr, "rename: ");
00651 
00652     rv = fop_rename(fopc, TEST_FILE1, TEST_FILE2);
00653     if (0 == rv) {
00654        fprintf(stderr, "error: rename should fail\n");
00655        return;
00656     }
00657 
00658     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00659     fop_close(fopc, fd);
00660 
00661     rv = fop_rename(fopc, TEST_FILE1, TEST_FILE2);
00662     if (0 != rv) {
00663        fprintf(stderr, "error: rename should succeed\n");
00664        return;
00665     }
00666 
00667     if (0 == fop_stat(fopc, TEST_FILE1, &st)) {
00668        fprintf(stderr, "fail: stat on \"%s\" should fail\n", TEST_FILE1);
00669     } else if (0 != fop_stat(fopc, TEST_FILE2, &st)) {
00670        fprintf(stderr, "fail: stat on \"%s\" should succeed\n", TEST_FILE2);
00671     } else {
00672        fprintf(stderr, "succeed\n");
00673     }
00674 
00675     fop_unlink(fopc, TEST_FILE1);
00676     fop_unlink(fopc, TEST_FILE2);
00677 }
00678 
00679 
00680 void
00681 test_fcntl(void * fopc)
00682 {
00683     int              fd;
00684     int              rv;
00685 
00686     fprintf(stderr, "fcntl: ");
00687 
00688     rv = fop_fcntl(fopc, 99, F_GETFD);
00689     if (0 <= rv) {
00690        fprintf(stderr, "error: fcntl on invalid fd should fail\n");
00691        return;
00692     }
00693 
00694     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00695 
00696     fop_fcntl(fopc, fd, F_SETFD, FD_CLOEXEC);
00697     rv = fop_fcntl(fopc, fd, F_GETFD);
00698     if (rv < 0) {
00699        fprintf(stderr, "error: fcntl should succeed\n");
00700     } else if (FD_CLOEXEC != rv) {
00701        fprintf(stderr, "error: invalid flags 0x%x\n", rv);
00702     } else {
00703        fprintf(stderr, "succeed\n");
00704     }
00705 
00706     fop_close(fopc, fd);
00707     fop_unlink(fopc, TEST_FILE1);
00708 }
00709 
00710 
00711 void
00712 test_truncate(void * fopc)
00713 {
00714     int              fd;
00715     struct stat      st;
00716     int              rv;
00717 
00718     fprintf(stderr, "truncate: ");
00719 
00720     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00721 
00722     fop_write(fopc, fd, ABC, 26);
00723     fop_close(fopc, fd);
00724 
00725     rv = fop_truncate(fopc, TEST_FILE1, 16);
00726     if (0 != rv) {
00727        fprintf(stderr, "fail: truncate should succeed\n");
00728     } else if (0 != fop_stat(fopc, TEST_FILE1, &st)) {
00729        fprintf(stderr, "fail: stat error on %s\n", TEST_FILE1);
00730        if (16 != st.st_size) {
00731            fprintf(stderr,
00732                   "fail: size not turncated %lu\n",
00733                   (unsigned long)st.st_size);
00734        } else {
00735            fprintf(stderr, "succeed\n");
00736        }
00737     } else {
00738        fprintf(stderr, "succeed\n");
00739     }
00740 
00741     fop_unlink(fopc, TEST_FILE1);
00742 }
00743 
00744 
00745 void
00746 test_ftruncate(void * fopc)
00747 {
00748     int              fd;
00749     struct stat      st;
00750     int              rv;
00751 
00752     fprintf(stderr, "ftruncate: ");
00753 
00754     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00755 
00756     fop_write(fopc, fd, ABC, 26);
00757 
00758     rv = fop_ftruncate(fopc, fd, 16);
00759     fop_close(fopc, fd);
00760 
00761     if (0 != rv) {
00762        fprintf(stderr, "fail: truncate should succeed\n");
00763     } else if (0 != fop_stat(fopc, TEST_FILE1, &st)) {
00764        fprintf(stderr, "fail: stat error on %s\n", TEST_FILE1);
00765        if (16 != st.st_size) {
00766            fprintf(stderr,
00767                   "fail: size not truncated %lu\n",
00768                   (unsigned long)st.st_size);
00769        } else {
00770            fprintf(stderr, "succeed\n");
00771        }
00772     } else {
00773        fprintf(stderr, "succeed\n");
00774     }
00775 
00776     fop_unlink(fopc, TEST_FILE1);
00777 }
00778 
00779 
00780 void
00781 test_opendir(void * fopc)
00782 {
00783     int                     fd;
00784     DIR *            dirp;
00785     struct dirent *  de;
00786     char             path[PATH_MAX];
00787     int                     found1;
00788     int                     found2;
00789 
00790     fprintf(stderr, "opendir: ");
00791 
00792     fop_mkdir(fopc, TEST_DIR1, 0777);
00793     fd = fop_open(fopc, TEST_DIR_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00794     fop_close(fopc, fd);
00795     fd = fop_open(fopc, TEST_DIR_FILE2, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00796     fop_close(fopc, fd);
00797     found1 = 0;
00798     found2 = 0;
00799 
00800     dirp = fop_opendir(fopc, TEST_DIR1);
00801     while (NULL != (de = fop_readdir(fopc, dirp))) {
00802        if ((0 == strcmp(".", de->d_name)) ||
00803            (0 == strcmp("..", de->d_name))) {
00804            continue;
00805        }
00806        snprintf(path, sizeof (path), "%s/%s", TEST_DIR1, de->d_name);
00807        if (0 == strcmp(path, TEST_DIR_FILE1)) {
00808            found1 = 1;
00809        } else if (0 == strcmp(path, TEST_DIR_FILE2)) {
00810            found2 = 1;
00811        }
00812     }
00813     fop_closedir(fopc, dirp);
00814 
00815     if ((1 == found1) && (1 == found2)) {
00816        fprintf(stderr, "succeed\n");
00817     } else {
00818        fprintf(stderr, "fail: file not found\n");
00819     }
00820 
00821     fop_unlink(fopc, TEST_DIR_FILE1);
00822     fop_unlink(fopc, TEST_DIR_FILE2);
00823     fop_rmdir(fopc, TEST_DIR1);
00824 }
00825 
00826 
00827 void
00828 test_readdir(void * fopc)
00829 {
00830     int                     fd;
00831     DIR *            dirp;
00832     struct dirent *  de;
00833     char             path[PATH_MAX];
00834     int                     found1;
00835     int                     found2;
00836 
00837     fprintf(stderr, "readdir: ");
00838 
00839     fop_mkdir(fopc, TEST_DIR1, 0777);
00840     fd = fop_open(fopc, TEST_DIR_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00841     fop_close(fopc, fd);
00842     fd = fop_open(fopc, TEST_DIR_FILE2, O_WRONLY | O_CREAT | O_TRUNC, 0655);
00843     fop_close(fopc, fd);
00844     found1 = 0;
00845     found2 = 0;
00846 
00847     dirp = fop_opendir(fopc, TEST_DIR1);
00848     while (NULL != (de = fop_readdir(fopc, dirp))) {
00849        if ((0 == strcmp(".", de->d_name)) ||
00850            (0 == strcmp("..", de->d_name))) {
00851            continue;
00852        }
00853        snprintf(path, sizeof (path), "%s/%s", TEST_DIR1, de->d_name);
00854        if (0 == strcmp(path, TEST_DIR_FILE1)) {
00855            found1 = 1;
00856        } else if (0 == strcmp(path, TEST_DIR_FILE2)) {
00857            found2 = 1;
00858        }
00859     }
00860     fop_closedir(fopc, dirp);
00861 
00862     if ((1 == found1) && (1 == found2)) {
00863        fprintf(stderr, "succeed\n");
00864     } else {
00865        fprintf(stderr, "fail: files not found\n");
00866     }
00867 
00868     fop_unlink(fopc, TEST_DIR_FILE1);
00869     fop_unlink(fopc, TEST_DIR_FILE2);
00870     fop_rmdir(fopc, TEST_DIR1);
00871 }
00872 
00873 
00874 void
00875 test_closedir(void * fopc)
00876 {
00877     DIR *            dirp;
00878 
00879     fprintf(stderr, "closedir: ");
00880 
00881     fop_mkdir(fopc, TEST_DIR1, 0777);
00882 
00883     dirp = fop_opendir(fopc, TEST_DIR1);
00884     if (0 == fop_closedir(fopc, dirp)) {
00885        fprintf(stderr, "succeed\n");
00886     } else {
00887        fprintf(stderr, "failed\n");
00888     }
00889 
00890     fop_rmdir(fopc, TEST_DIR1);
00891 }
00892 
00893 
00894 void
00895 test_access(void * fopc)
00896 {
00897     int       rv;
00898     int       fd;
00899 
00900     fprintf(stderr, "access: ");
00901 
00902     rv = fop_access(fopc, TEST_FILE1, F_OK);
00903     if (0 == rv) {
00904        fprintf(stderr, "fail: F_OK should fail on none-existent file\n");
00905        return;
00906     }
00907 
00908     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0600);
00909     fop_close(fopc, fd);
00910 
00911     if (0 != fop_access(fopc, TEST_FILE1, R_OK)) {
00912        fprintf(stderr, "fail: R_OK should succeed\n");
00913     } else if (0 == fop_access(fopc, TEST_FILE1, X_OK)) {
00914        fprintf(stderr, "fail: X_OK should fail\n");
00915     } else {
00916        fprintf(stderr, "succeed\n");
00917     }
00918 
00919     fop_unlink(fopc, TEST_FILE1);
00920 }
00921 
00922 
00923 void
00924 test_chmod(void * fopc)
00925 {
00926     int              rv;
00927     int              fd;
00928     struct stat      st;
00929 
00930     fprintf(stderr, "chmod: ");
00931 
00932     rv = fop_chmod(fopc, TEST_FILE1, 0555);
00933     if (0 == rv) {
00934        fprintf(stderr, "fail: should fail on none-existent file\n");
00935        return;
00936     }
00937 
00938     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0600);
00939     fop_close(fopc, fd);
00940 
00941     if (0 != fop_chmod(fopc, TEST_FILE1, 0555)) {
00942        fprintf(stderr, "fail: should succeed\n");
00943     } else {
00944        fop_stat(fopc, TEST_FILE1, &st);
00945        if (0555 != (S_IAMB & st.st_mode)) {
00946            fprintf(stderr,
00947                   "fail: incorrect mode: %d\n", (S_IAMB & st.st_mode));
00948        } else {
00949            fprintf(stderr, "succeed\n");
00950        }
00951     }
00952 
00953     fop_unlink(fopc, TEST_FILE1);
00954 }
00955 
00956 
00957 void
00958 test_fchmod(void * fopc)
00959 {
00960     int              rv;
00961     int              fd;
00962     struct stat      st;
00963 
00964     fprintf(stderr, "fchmod: ");
00965 
00966     rv = fop_fchmod(fopc, 99, 0555);
00967     if (0 == rv) {
00968        fprintf(stderr, "fail: should fail on none-existent file\n");
00969        return;
00970     }
00971 
00972     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0600);
00973 
00974     if (0 != fop_fchmod(fopc, fd, 0555)) {
00975        fprintf(stderr, "fail: should succeed\n");
00976     } else {
00977        fop_fstat(fopc, fd, &st);
00978        if (0555 != (S_IAMB & st.st_mode)) {
00979            fprintf(stderr,
00980                   "fail: incorrect mode: %d\n", (S_IAMB & st.st_mode));
00981        } else {
00982            fprintf(stderr, "succeed\n");
00983        }
00984     }
00985 
00986     fop_close(fopc, fd);
00987     fop_unlink(fopc, TEST_FILE1);
00988 }
00989 
00990 
00991 void
00992 test_chown(void * fopc)
00993 {
00994     int              rv;
00995     int              fd;
00996     int              errno_save;
00997 
00998     fprintf(stderr, "chown: ");
00999 
01000     rv = fop_chown(fopc, TEST_FILE1, 99, 99);
01001     if (0 == rv) {
01002        fprintf(stderr, "fail: should fail on non-existent file\n");
01003        return;
01004     } else if (ENOENT != errno) {
01005        fprintf(stderr, "fail: invalid errno: %d should be ENOENT (%d)\n",
01006               errno, ENOENT);
01007        return;
01008     }
01009 
01010     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0600);
01011     fop_close(fopc, fd);
01012 
01013     rv = fop_chown(fopc, TEST_FILE1, 99, 99);
01014     errno_save = errno;
01015 
01016     switch (geteuid()) {
01017     case 0:
01018        if (0 != rv) {
01019            fprintf(stderr, "fail: uid = %d: should succeed\n", geteuid());
01020        } else {
01021            fprintf(stderr, "succeed\n");
01022        }
01023        break;
01024     default:
01025        if (0 == rv) {
01026            fprintf(stderr, "fail: uid = %d: should fail\n", geteuid());
01027        } else if (EPERM != errno_save) {
01028            fprintf(stderr, "invalid errno: %d should be EPERM (%d)\n", 
01029                  errno_save, EPERM);
01030        } else {
01031            fprintf(stderr, "succeed\n");
01032        }
01033        break;
01034     }
01035 
01036     fop_unlink(fopc, TEST_FILE1);
01037 }
01038 
01039 
01040 #if 0
01041 void
01042 test_lchown(void * fopc)
01043 {
01044     int              rv;
01045     int              fd;
01046     int              errno_save;
01047     uid_t     uid;
01048 
01049     fprintf(stderr, "lchown: ");
01050 
01051     uid = geteuid();
01052 
01053     rv = fop_lchown(fopc, TEST_FILE1, 99, 99);
01054     if (0 == rv) {
01055        fprintf(stderr, "fail: should fail on non-existent file\n");
01056        return;
01057     } else if ((0 == uid) && (ENOENT != errno)) {
01058        fprintf(stderr, "fail: invalid errno: %d should be ENOENT (%d)\n",
01059               errno, ENOENT);
01060        return;
01061     } else if ((0 != uid) && (EPERM != errno)) {
01062        fprintf(stderr, "fail: invalid errno: %d should be EPERM (%d)\n",
01063               errno, EPERM);
01064        return;
01065     }
01066 
01067     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0600);
01068     fop_close(fopc, fd);
01069 
01070     rv = fop_lchown(fopc, TEST_FILE1, 99, 99);
01071     errno_save = errno;
01072 
01073     switch (geteuid()) {
01074     case 0:
01075        if (0 != rv) {
01076            fprintf(stderr, "fail: uid = %d: should succeed\n", geteuid());
01077        } else {
01078            fprintf(stderr, "succeed\n");
01079        }
01080        break;
01081     default:
01082        if (0 == rv) {
01083            fprintf(stderr, "fail: uid = %d: should fail\n", geteuid());
01084        } else if (EPERM != errno_save) {
01085            fprintf(stderr, "invalid errno: %d should be EPERM (%d)\n", 
01086                  errno_save, EPERM);
01087        } else {
01088            fprintf(stderr, "succeed\n");
01089        }
01090        break;
01091     }
01092 
01093     fop_unlink(fopc, TEST_FILE1);
01094 }
01095 #endif
01096 
01097 
01098 void
01099 test_fchown(void * fopc)
01100 {
01101     int              rv;
01102     int              fd;
01103     int              errno_save;
01104     uid_t     uid;
01105 
01106     fprintf(stderr, "fchown: ");
01107 
01108     uid = geteuid();
01109 
01110     rv = fop_fchown(fopc, 99, 99, 99);
01111     if (0 == rv) {
01112        fprintf(stderr, "fail: should fail on non-existent file\n");
01113        return;
01114     } else if (EBADF != errno) {
01115        fprintf(stderr,
01116               "fail: invalid errno: %d should be EBADF (%d)\n",
01117               errno, EBADF);
01118        return;
01119     }
01120 
01121     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0600);
01122 
01123     rv = fop_fchown(fopc, fd, 99, 99);
01124     errno_save = errno;
01125 
01126     switch (geteuid()) {
01127     case 0:
01128        if (0 != rv) {
01129            fprintf(stderr, "fail: uid = %d: should succeed\n", geteuid());
01130        } else {
01131            fprintf(stderr, "succeed\n");
01132        }
01133        break;
01134     default:
01135        if (0 == rv) {
01136            fprintf(stderr, "fail: uid = %d: should fail\n", geteuid());
01137        } else if (EPERM != errno_save) {
01138            fprintf(stderr, "invalid errno: %d should be EPERM (%d)\n", 
01139                  errno_save, EPERM);
01140        } else {
01141            fprintf(stderr, "succeed\n");
01142        }
01143        break;
01144     }
01145 
01146     fop_close(fopc, fd);
01147     fop_unlink(fopc, TEST_FILE1);
01148 }
01149 
01150 
01151 #if 0
01152 void
01153 test_fpathconf(void * fopc)
01154 {
01155     long      rv;
01156     int              fd;
01157 
01158     fprintf(stderr, "fpathconf: ");
01159 
01160     rv = fop_fpathconf(fopc, 99, _PC_PATH_MAX);
01161     if (-1 != rv) {
01162        fprintf(stderr, "fail: should fail\n");
01163        return;
01164     } else if (EBADF != errno) {
01165        fprintf(stderr, "fail: invalid errno: %d should be EBADF (%d)\n",
01166               errno, EBADF);
01167        return;
01168     }
01169 
01170     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0600);
01171 
01172     rv = fop_fpathconf(fopc, fd, _PC_PATH_MAX);
01173     if (-1 != rv) {
01174        fprintf(stderr, "succeed\n");
01175     } else {
01176        fprintf(stderr, "fail: %ld\n", rv);
01177     }
01178 
01179     fop_close(fopc, fd);
01180     fop_unlink(fopc, TEST_FILE1);
01181 }
01182 
01183 
01184 void
01185 test_pathconf(void * fopc)
01186 {
01187     long      rv;
01188     int              fd;
01189 
01190     fprintf(stderr, "pathconf: ");
01191 
01192     rv = fop_pathconf(fopc, TEST_FILE1, _PC_PATH_MAX);
01193     if ((-1 == rv) && (ENOENT != errno)) {
01194        fprintf(stderr, "fail: invalid errno: %d should be ENOENT (%d)\n",
01195               errno, ENOENT);
01196        return;
01197     }
01198 
01199     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0600);
01200     fop_close(fopc, fd);
01201 
01202     rv = fop_pathconf(fopc, TEST_FILE1, _PC_PATH_MAX);
01203     if (-1 != rv) {
01204        fprintf(stderr, "succeed\n");
01205     } else {
01206        fprintf(stderr, "fail: %lu\n", rv);
01207     }
01208 
01209     fop_unlink(fopc, TEST_FILE1);
01210 }
01211 #endif
01212 
01213 
01214 void
01215 test_utime(void * fopc)
01216 {
01217     int       rv;
01218     int       fd;
01219 
01220     fprintf(stderr, "utime: ");
01221 
01222     rv = fop_utime(fopc, TEST_FILE1, NULL);
01223     if (-1 != rv) {
01224        fprintf(stderr, "fail: should fail");
01225        return;
01226     } else if (ENOENT != errno) {
01227        fprintf(stderr, "fail: invalid errno: %d should be ENOENT (%d)\n",
01228               errno, ENOENT);
01229        return;
01230     }
01231 
01232     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0600);
01233     fop_close(fopc, fd);
01234 
01235     rv = fop_utime(fopc, TEST_FILE1, NULL);
01236     if (-1 != rv) {
01237        fprintf(stderr, "succeed\n");
01238     } else {
01239        fprintf(stderr, "fail: %d\n", rv);
01240     }
01241 
01242     fop_unlink(fopc, TEST_FILE1);
01243 }
01244 
01245 
01246 void
01247 test_utimes(void * fopc)
01248 {
01249     int       rv;
01250     int       fd;
01251 
01252     fprintf(stderr, "utimes: ");
01253 
01254     rv = fop_utimes(fopc, TEST_FILE1, NULL);
01255     if (-1 != rv) {
01256        fprintf(stderr, "fail: should fail");
01257        return;
01258     } else if (ENOENT != errno) {
01259        fprintf(stderr, "fail: invalid errno: %d should be ENOENT (%d)\n",
01260               errno, ENOENT);
01261        return;
01262     }
01263 
01264     fd = fop_open(fopc, TEST_FILE1, O_WRONLY | O_CREAT | O_TRUNC, 0600);
01265     fop_close(fopc, fd);
01266 
01267     rv = fop_utimes(fopc, TEST_FILE1, NULL);
01268     if (-1 != rv) {
01269        fprintf(stderr, "succeed\n");
01270     } else {
01271        fprintf(stderr, "fail: %d\n", rv);
01272     }
01273 
01274     fop_unlink(fopc, TEST_FILE1);
01275 }
01276 
01277 
01278 int
01279 fop_test_cases_all(void * ptr, iml_fop_get_function_t fop_get_function)
01280 {
01281     void *    fopc;
01282 
01283     fop__fopc_create =
01284        (iml__fopc_create_t)(fop_get_function("_nsc_create"));
01285     if (NULL == fop__fopc_create) fprintf(stderr, "_nsc_create: fail\n");
01286     fop__fopc_free = (iml__fopc_free_t)(fop_get_function("_nsc_free"));
01287     if (NULL == fop__fopc_free) fprintf(stderr, "_nsc_free: fail\n");
01288     fop_access = (iml_fop_access_t)(fop_get_function("access"));
01289     if (NULL == fop_access) fprintf(stderr, "access: fail\n");
01290     fop_chmod = (iml_fop_chmod_t)(fop_get_function("chmod"));
01291     if (NULL == fop_chmod) fprintf(stderr, "chmod: fail\n");
01292     fop_fchmod = (iml_fop_fchmod_t)(fop_get_function("fchmod"));
01293     if (NULL == fop_fchmod) fprintf(stderr, "fchmod: fail\n");
01294     fop_chown = (iml_fop_chown_t)(fop_get_function("chown"));
01295     if (NULL == fop_chown) fprintf(stderr, "chown: fail\n");
01296 #if 0
01297     fop_lchown = (iml_fop_lchown_t)(fop_get_function("lchown"));
01298     if (NULL == fop_lchown) fprintf(stderr, "lchown: fail\n");
01299 #endif
01300     fop_fchown = (iml_fop_fchown_t)(fop_get_function("fchown"));
01301     if (NULL == fop_fchown) fprintf(stderr, "fchown: fail\n");
01302     fop_close = (iml_fop_close_t)(fop_get_function("close"));
01303     if (NULL == fop_close) fprintf(stderr, "close: fail\n");
01304     fop_closedir = (iml_fop_closedir_t)(fop_get_function("closedir"));
01305     if (NULL == fop_closedir) fprintf(stderr, "closedir: fail\n");
01306     fop_creat = (iml_fop_creat_t)(fop_get_function("creat"));
01307     if (NULL == fop_creat) fprintf(stderr, "creat: fail\n");
01308     fop_fcntl = (iml_fop_fcntl_t)(fop_get_function("fcntl"));
01309     if (NULL == fop_fcntl) fprintf(stderr, "fcntl: fail\n");
01310 #if 0
01311     fop_fpathconf = (iml_fop_fpathconf_t)(fop_get_function("fpathconf"));
01312     if (NULL == fop_fpathconf) fprintf(stderr, "fpathconf: fail\n");
01313 #endif
01314     fop_fstat = (iml_fop_fstat_t)(fop_get_function("fstat"));
01315     if (NULL == fop_fstat) fprintf(stderr, "fstat: fail\n");
01316     fop_ftruncate = (iml_fop_ftruncate_t)(fop_get_function("ftruncate"));
01317     if (NULL == fop_ftruncate) fprintf(stderr, "ftruncate: fail\n");
01318     fop_link = (iml_fop_link_t)(fop_get_function("link"));
01319     if (NULL == fop_link) fprintf(stderr, "link: fail\n");
01320     fop_lseek = (iml_fop_lseek_t)(fop_get_function("lseek"));
01321     if (NULL == fop_lseek) fprintf(stderr, "lseek: fail\n");
01322     fop_lstat = (iml_fop_lstat_t)(fop_get_function("lstat"));
01323     if (NULL == fop_lstat) fprintf(stderr, "lstat: fail\n");
01324     fop_mkdir = (iml_fop_mkdir_t)(fop_get_function("mkdir"));
01325     if (NULL == fop_mkdir) fprintf(stderr, "mkdir: fail\n");
01326     fop_open = (iml_fop_open_t)(fop_get_function("open"));
01327     if (NULL == fop_open) fprintf(stderr, "open: fail\n");
01328     fop_opendir = (iml_fop_opendir_t)(fop_get_function("opendir"));
01329     if (NULL == fop_opendir) fprintf(stderr, "opendir: fail\n");
01330 #if 0
01331     fop_pathconf = (iml_fop_pathconf_t)(fop_get_function("pathconf"));
01332     if (NULL == fop_pathconf) fprintf(stderr, "pathconf: fail\n");
01333 #endif
01334     fop_read = (iml_fop_read_t)(fop_get_function("read"));
01335     if (NULL == fop_read) fprintf(stderr, "read: fail\n");
01336     fop_readdir = (iml_fop_readdir_t)(fop_get_function("readdir"));
01337     if (NULL == fop_readdir) fprintf(stderr, "readdir: fail\n");
01338 #if 0
01339     fop_readv = (iml_fop_readv_t)(fop_get_function("readv"));
01340     if (NULL == fop_readv) fprintf(stderr, "readv: fail\n");
01341 #endif
01342     fop_rename = (iml_fop_rename_t)(fop_get_function("rename"));
01343     if (NULL == fop_rename) fprintf(stderr, "rename: fail\n");
01344     fop_rmdir = (iml_fop_rmdir_t)(fop_get_function("rmdir"));
01345     if (NULL == fop_rmdir) fprintf(stderr, "rmdir: fail\n");
01346     fop_stat = (iml_fop_stat_t)(fop_get_function("stat"));
01347     if (NULL == fop_stat) fprintf(stderr, "stat: fail\n");
01348     fop_symlink = (iml_fop_symlink_t)(fop_get_function("symlink"));
01349     if (NULL == fop_symlink) fprintf(stderr, "symlink: fail\n");
01350     fop_truncate = (iml_fop_truncate_t)(fop_get_function("truncate"));
01351     if (NULL == fop_truncate) fprintf(stderr, "truncate: fail\n");
01352     fop_unlink = (iml_fop_unlink_t)(fop_get_function("unlink"));
01353     if (NULL == fop_unlink) fprintf(stderr, "unlink: fail\n");
01354     fop_utime = (iml_fop_utime_t)(fop_get_function("utime"));
01355     if (NULL == fop_utime) fprintf(stderr, "utime: fail\n");
01356     fop_utimes = (iml_fop_utimes_t)(fop_get_function("utimes"));
01357     if (NULL == fop_utimes) fprintf(stderr, "utimes: fail\n");
01358     fop_write = (iml_fop_write_t)(fop_get_function("write"));
01359     if (NULL == fop_write) fprintf(stderr, "write: fail\n");
01360 #if 0
01361     fop_writev = (iml_fop_writev_t)(fop_get_function("writev"));
01362     if (NULL == fop_writev) fprintf(stderr, "writev: fail\n");
01363 #endif
01364 
01365     fopc = fop__fopc_create("fop_test", IML_NSC_TYPE_DESKTOP, ptr);
01366 
01367     test_prep(fopc);
01368     test_open(fopc);
01369     test_read(fopc);
01370 #if 0
01371     test_readv(fopc);
01372 #endif
01373     test_write(fopc);
01374 #if 0
01375     test_writev(fopc);
01376 #endif
01377     test_close(fopc);
01378     test_creat(fopc);
01379     test_lseek(fopc);
01380     test_stat(fopc);
01381     test_lstat(fopc);
01382     test_fstat(fopc);
01383     test_mkkdir(fopc);
01384     test_rmdir(fopc);
01385     test_symlink(fopc);
01386     test_link(fopc);
01387     test_unlink(fopc);
01388     test_rename(fopc);
01389     test_fcntl(fopc);
01390     test_truncate(fopc);
01391     test_ftruncate(fopc);
01392     test_opendir(fopc);
01393     test_readdir(fopc);
01394     test_closedir(fopc);
01395     test_access(fopc);
01396     test_chmod(fopc);
01397     test_fchmod(fopc);
01398     test_chown(fopc);
01399 #if 0
01400     test_lchown(fopc);
01401 #endif
01402     test_fchown(fopc);
01403 #if 0
01404     test_fpathconf(fopc);
01405     test_pathconf(fopc);
01406 #endif
01407     test_utime(fopc);
01408     test_utimes(fopc);
01409 
01410     fop__fopc_free(fopc);
01411 
01412     return 0;
01413 }
01414 
01415 /* Local Variables: */
01416 /* c-file-style: "iiim-project" */
01417 /* End: */