IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12649


Ignore:
Timestamp:
Mar 28, 2007, 1:24:00 PM (19 years ago)
Author:
jhoblitt
Message:

convert tests to use libtap

Location:
trunk/Nebulous/nebclient
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/nebclient/autogen.sh

    r11607 r12649  
    8787&& rm -f src/*.xml
    8888
     89cd tests/tap
     90sh bootstrap.sh || echo "libtap bootstrap.sh failed"
     91
    8992run_configure=true
    9093for arg in $*; do
  • trunk/Nebulous/nebclient/configure.ac

    r10633 r12649  
    11dnl Copyright (C) 2005  Joshua Hoblitt
    22dnl
    3 dnl $Id: configure.ac,v 1.12 2006-12-12 00:31:39 jhoblitt Exp $
     3dnl $Id: configure.ac,v 1.13 2007-03-28 23:24:00 jhoblitt Exp $
    44
    55AC_PREREQ(2.59)
     
    77AC_INIT([nebclient], [0.0.3], [jhoblitt@cpan.org])
    88AC_CONFIG_SRCDIR([nebulous.wsdl])
     9
     10dnl this enables the building of libtap
     11AC_CONFIG_SUBDIRS([test/tap])
    912
    1013AM_INIT_AUTOMAKE([1.6 foreign dist-bzip2])
  • trunk/Nebulous/nebclient/tests/Makefile.am

    r4622 r12649  
     1SUBDIRS = tap
     2
    13TESTS = tests
    24
     5AM_CPPFLAGS = \
     6    -I$(top_srcdir)/tests/tap/src \
     7    -I$(top_srcdir)/src
     8
     9AM_LDFLAGS = \
     10    $(top_builddir)/tests/tap/src/libtap.la \
     11    $(top_builddir)/src/libnebclient.la
     12
    313check_PROGRAMS = tests
    4 tests_SOURCES = tests.c
    5 tests_CPPFLAGS = -I$(top_srcdir)/src$
    6 tests_LDADD = $(top_builddir)/src/libnebclient.la
  • trunk/Nebulous/nebclient/tests/tests.c

    r12624 r12649  
    33#include <unistd.h>
    44#include <stdbool.h>
     5
    56#include "nebclient.h"
    6 
    7 #define TESTS(num_tests) \
    8     int test_num = 0; \
    9     int test_failure = 0; \
    10     printf("1..%d\n", num_tests);
    11 
    12 #define OK(test, name) \
    13     test_num++; \
    14     if (test) { \
    15         printf("ok %d - %s\n", test_num, name); \
    16     } else { \
    17         test_failure++; \
    18         printf("not ok %d - %s\n", test_num, name); \
    19         printf("# %s\n", nebErr(server)); \
    20     }
    21 
    22 #define TEST_EXIT \
    23     exit(test_failure);
     7#include "tap.h"
    248
    259int main (int argc, char **argv) {
     
    2711    char            *key = "foobarbaz";
    2812
    29     TESTS(22);
     13    plan_tests(22);
    3014
    3115    if (getenv("NEBULOUS_SERVER")) {
     
    3418        server = nebServerAlloc(NULL);
    3519    }
    36     OK(server, "server not NULL");
     20    ok(server, "server not NULL");
    3721
    3822    printf("# server set to %s\n", server->endpoint);
     
    4428        filename = nebCreate(server, key, 0, NULL, NULL, &URI);
    4529
    46         OK(filename, "create object");
    47         OK(URI, "URI not NULL");
    48         OK(nebDelete(server, key), "delete object");
     30        ok(filename, "create object");
     31        ok(URI, "URI not NULL");
     32        ok(nebDelete(server, key), "delete object");
    4933
    5034        nebFree(URI);
     
    5842        fh = nebOpenCreate(server, key, 0, NULL, NULL, &URI);
    5943
    60         OK(fh > -1, "create new object filehandle");
    61         OK(URI, "URI not NULL");
     44        ok(fh > -1, "create new object filehandle");
     45        ok(URI, "URI not NULL");
    6246
    6347        nebFree(URI);
     
    7054        fh = nebOpen(server, key, NEB_READ);
    7155
    72         OK(fh, "open object for reading");
     56        ok(fh, "open object for reading");
    7357
    7458        close(fh);
     
    8064        fh = nebOpen(server, key, NEB_WRITE);
    8165
    82         OK(fh, "open object for writing");
     66        ok(fh, "open object for writing");
    8367
    8468        close(fh);
     
    8670
    8771
    88     OK(nebReplicate(server, key, NULL, NULL), "replicate object");
     72    ok(nebReplicate(server, key, NULL, NULL), "replicate object");
    8973
    90     OK(nebOpen(server, key, NEB_WRITE) < 0, "write to object with multiple instances");
     74    ok(nebOpen(server, key, NEB_WRITE) < 0, "write to object with multiple instances");
    9175
    92     OK(nebCull(server, key), "cull object");
     76    ok(nebCull(server, key), "cull object");
    9377
    94     OK(nebStat(server, key), "stat object");
     78    ok(nebStat(server, key), "stat object");
    9579
    96     OK(nebLock(server, key, NEB_WRITE), "lock object write");
    97     OK(nebUnlock(server, key, NEB_WRITE), "unlock object write");
     80    ok(nebLock(server, key, NEB_WRITE), "lock object write");
     81    ok(nebUnlock(server, key, NEB_WRITE), "unlock object write");
    9882
    99     OK(nebLock(server, key, NEB_READ), "lock object read");
    100     OK(nebUnlock(server, key, NEB_READ), "unlock object read");
     83    ok(nebLock(server, key, NEB_READ), "lock object read");
     84    ok(nebUnlock(server, key, NEB_READ), "unlock object read");
    10185
    10286    {
     
    10589        locations = nebFindInstances(server, key, NULL);
    10690
    107         OK(locations, "locations not NULL");
    108         OK(locations && locations->n == 1, "find instances");
     91        ok(locations, "locations not NULL");
     92        ok(locations && locations->n == 1, "find instances");
    10993
    11094        nebObjectInstancesFree(locations);
     
    116100        filename = nebFind(server, key);
    117101
    118         OK(filename, "find file name");
     102        ok(filename, "find file name");
    119103
    120104        nebFree(filename);
     
    122106
    123107
    124     OK(nebCopy(server, key, "copyiedfile"), "copy object");
     108    ok(nebCopy(server, key, "copyiedfile"), "copy object");
    125109
    126     OK(nebDelete(server, key), "delete object");
     110    ok(nebDelete(server, key), "delete object");
    127111
    128     OK(nebMove(server, "copyiedfile", "movedfile"), "move object");
     112    ok(nebMove(server, "copyiedfile", "movedfile"), "move object");
    129113
    130114    if (!nebDelete(server, "movedfile")) {
     
    134118    nebServerFree(server);
    135119
    136     TEST_EXIT;
     120    return exit_status();
    137121}
Note: See TracChangeset for help on using the changeset viewer.