Changeset 8754

Show
Ignore:
Timestamp:
03/03/11 17:58:33 (2 years ago)
Author:
sampson
Message:

Windows testing

Location:
branches/windows-client
Files:
2 added
3 modified

Legend:

Unmodified
Added
Removed
  • branches/windows-client/projects/TestOrangeFS/TestOrangeFS.sln

    r8743 r8754  
    138138EndProject 
    139139Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client-test", "client-test\client-test.vcxproj", "{28761587-FE68-4AEB-8BF0-AB73484A0AD4}" 
     140EndProject 
     141Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "posix-test", "posix-test\posix-test.vcxproj", "{D3738B06-0CF0-438F-856D-AA92B07F584E}" 
    140142EndProject 
    141143Global 
     
    293295                {28761587-FE68-4AEB-8BF0-AB73484A0AD4}.Release|Win32.Build.0 = Release|Win32 
    294296                {28761587-FE68-4AEB-8BF0-AB73484A0AD4}.Release|x64.ActiveCfg = Release|Win32 
     297                {D3738B06-0CF0-438F-856D-AA92B07F584E}.Debug|Win32.ActiveCfg = Debug|Win32 
     298                {D3738B06-0CF0-438F-856D-AA92B07F584E}.Debug|Win32.Build.0 = Debug|Win32 
     299                {D3738B06-0CF0-438F-856D-AA92B07F584E}.Debug|x64.ActiveCfg = Debug|Win32 
     300                {D3738B06-0CF0-438F-856D-AA92B07F584E}.Release|Win32.ActiveCfg = Release|Win32 
     301                {D3738B06-0CF0-438F-856D-AA92B07F584E}.Release|Win32.Build.0 = Release|Win32 
     302                {D3738B06-0CF0-438F-856D-AA92B07F584E}.Release|x64.ActiveCfg = Release|Win32 
    295303        EndGlobalSection 
    296304        GlobalSection(SolutionProperties) = preSolution 
  • branches/windows-client/src/client/windows/client-test/test-io.c

    r8747 r8754  
    422422    struct timeval start; 
    423423    double elapsed; 
    424     unsigned int *total = 0; 
     424    unsigned int *total; 
    425425    FILE *f; 
    426426 
     
    449449        } 
    450450        elapsed = timer_elapsed(&start); 
    451         total += (unsigned int) (elapsed * 1000000.0); 
     451        *total += (unsigned int) (elapsed * 1000000.0); 
    452452 
    453453        free(file_name); 
     
    455455 
    456456    free(dir_name); 
     457 
     458    pthread_exit(total); 
    457459 
    458460    return total; 
     
    464466    pthread_t *hthreads; 
    465467    int threadi, ret, i, code = 0; 
    466     unsigned int *counter, total; 
     468    unsigned int total; 
     469    void *counter; 
    467470    struct timeval start; 
    468471    double elapsed; 
     
    491494        for (i = 0; i < THREAD_COUNT && code == 0; i++) 
    492495        { 
    493             counter = (unsigned int *) malloc(sizeof(unsigned int)); 
    494  
    495496            /* return value is time in microseconds */ 
    496             code = pthread_join(hthreads[threadi], &counter); 
    497             total += *counter; 
     497            code = pthread_join(hthreads[i], &counter);             
     498            total += *((unsigned int *) counter); 
    498499 
    499500            free(counter); 
     
    526527    io_file_mt_cleanup(options); 
    527528 
    528     free(counter); 
    529529    free(hthreads); 
    530530    free(args); 
  • branches/windows-client/test/posix/open.c

    r5718 r8754  
    55 */ 
    66#include <stdio.h> 
     7#ifdef WIN32 
     8#include <Windows.h> 
     9#include <io.h> 
     10#else 
    711#include <sys/time.h> 
     12#endif 
    813#include <string.h> 
    914#include <errno.h> 
     15#ifndef WIN32 
    1016#include <unistd.h> 
     17#endif 
    1118#include <stdlib.h> 
    1219#include <sys/types.h> 
     
    1421#include <fcntl.h> 
    1522#include <time.h> 
     23#ifndef WIN32 
    1624#include <linux/unistd.h> 
    1725#include "sha1.h" 
    1826#include "crc32c.h" 
     27#endif 
    1928#include "mpi.h" 
    2029 
     30#ifdef WIN32 
     31#define open(f, o, p)    _open(f, o, p) 
     32#define close(f)         _close(f) 
     33#define unlink(f)        _unlink(f) 
     34#endif 
     35 
     36#if 0 
    2137static inline double msec_diff(double *end, double *begin) 
    2238{ 
    2339        return (*end - *begin); 
    2440} 
     41#endif 
    2542 
     43#ifdef WIN32 
     44static double Wtime(void) 
     45{ 
     46    LARGE_INTEGER counter; 
     47 
     48    QueryPerformanceCounter(&counter); 
     49 
     50    return (double) counter.QuadPart; 
     51} 
     52#else 
    2653static double Wtime(void) 
    2754{ 
     
    3057    return((double)t.tv_sec * 1e03 + (double)(t.tv_usec) * 1e-03); 
    3158} 
     59#endif 
    3260 
     61#if 0 
    3362struct file_handle_generic { 
    3463        /* Filled by VFS */ 
     
    3968        unsigned char fhg_hmac_sha1[24]; /* hmac-sha1 message authentication code */ 
    4069}; 
     70#endif 
    4171 
    4272int main(int argc, char *argv[]) 
     
    4878        int open_flags = 0; 
    4979        int i, rank, np; 
     80#ifdef WIN32 
     81        LARGE_INTEGER freq; 
     82        HANDLE hFile; 
     83#endif 
    5084 
    5185        MPI_Init(&argc, &argv); 
    5286        MPI_Comm_rank(MPI_COMM_WORLD, &rank); 
    5387        MPI_Comm_size(MPI_COMM_WORLD, &np); 
    54  
     88#ifdef WIN32 
     89        /* just use one option for now */ 
     90        fname = argv[1]; 
     91        open_flags |= O_CREAT; 
     92        do_create = 1; 
     93#else 
    5594        while ((c = getopt(argc, argv, opt)) != EOF) { 
    5695                switch (c) { 
     
    76115                } 
    77116        } 
     117#endif 
    78118        if (fname == NULL) 
    79119        { 
     
    89129 
    90130                        begin = Wtime(); 
     131#ifdef WIN32 
     132                        hFile = CreateFile(fname, 
     133                                           GENERIC_READ | GENERIC_WRITE, 
     134                                           FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 
     135                                           NULL, 
     136                                           CREATE_ALWAYS, 
     137                                           FILE_ATTRIBUTE_NORMAL, 
     138                                           NULL); 
     139                        if (hFile == INVALID_HANDLE_VALUE) 
     140                        { 
     141                            fprintf(stderr, "CreateFile: %d\n", GetLastError()); 
     142                            MPI_Finalize(); 
     143                            exit(1); 
     144                        } 
     145#else 
    91146                        fd = open(fname, open_flags, 0775); 
    92147                        if (fd < 0) { 
     
    95150                                exit(1); 
    96151                        } 
     152#endif 
    97153                        end = Wtime(); 
    98154                        tdiff += (end - begin); 
     155#ifdef WIN32 
     156                        CloseHandle(hFile); 
     157#else 
    99158                        close(fd); 
     159#endif 
    100160                        if (rank == 0 && i < (niters - 1)) 
    101161                                unlink(fname); 
    102162        } 
     163         
     164#ifdef WIN32 
     165        QueryPerformanceFrequency(&freq); 
     166        tdiff = tdiff / (double) freq.QuadPart * 1000.0; 
     167#endif 
    103168        tdiff = tdiff / niters; 
    104169        MPI_Allreduce(&tdiff, &max_diff, 1,