|
| 1 | +/* |
| 2 | + * Copyright (c) 2018, Lawrence Livermore National Security, LLC. |
| 3 | + * Produced at the Lawrence Livermore National Laboratory. |
| 4 | + * |
| 5 | + * Copyright 2018, UT-Battelle, LLC. |
| 6 | + * |
| 7 | + * LLNL-CODE-741539 |
| 8 | + * All rights reserved. |
| 9 | + * |
| 10 | + * This is the license for UnifyFS. |
| 11 | + * For details, see https://github.com/LLNL/UnifyFS. |
| 12 | + * Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. |
| 13 | + */ |
| 14 | + |
| 15 | +#include <string.h> |
| 16 | +#include <mpi.h> |
| 17 | +#include <unifyfs.h> |
| 18 | +#include "t/lib/tap.h" |
| 19 | +#include "t/lib/testutil.h" |
| 20 | + |
| 21 | +#include "statfs_suite.h" |
| 22 | + |
| 23 | +/* The test suite for statfs wrappers found in client/src/unifyfs-sysio.c. |
| 24 | + * |
| 25 | + * This is specifically designed to test stafs when client super magic has |
| 26 | + * been disabled, so that statfs returns TMPFS_MAGIC. */ |
| 27 | +int main(int argc, char* argv[]) |
| 28 | +{ |
| 29 | + int rank_num; |
| 30 | + int rank; |
| 31 | + char* unifyfs_root; |
| 32 | + int rc; |
| 33 | + |
| 34 | + MPI_Init(&argc, &argv); |
| 35 | + MPI_Comm_size(MPI_COMM_WORLD, &rank_num); |
| 36 | + MPI_Comm_rank(MPI_COMM_WORLD, &rank); |
| 37 | + |
| 38 | + plan(NO_PLAN); |
| 39 | + |
| 40 | + unifyfs_root = testutil_get_mount_point(); |
| 41 | + |
| 42 | + /* Verify unifyfs_mount succeeds. */ |
| 43 | + rc = unifyfs_mount(unifyfs_root, rank, rank_num, 0); |
| 44 | + ok(rc == 0, "unifyfs_mount(%s) (rc=%d)", unifyfs_root, rc); |
| 45 | + |
| 46 | + /* If the mount fails, bailout, as there is no point in running the tests */ |
| 47 | + if (rc != 0) { |
| 48 | + BAIL_OUT("unifyfs_mount in statfs_suite failed"); |
| 49 | + } |
| 50 | + |
| 51 | + /* check that statfs returns TMPFS_MAGIC |
| 52 | + * when UNIFYFS_CLIENT_SUPER_MAGIC=0 */ |
| 53 | + statfs_test(unifyfs_root, 0); |
| 54 | + |
| 55 | + rc = unifyfs_unmount(); |
| 56 | + ok(rc == 0, "unifyfs_unmount(%s) (rc=%d)", unifyfs_root, rc); |
| 57 | + |
| 58 | + MPI_Finalize(); |
| 59 | + |
| 60 | + done_testing(); |
| 61 | + |
| 62 | + return 0; |
| 63 | +} |
0 commit comments