Commit ac9ac9d3 authored by Greg Williams's avatar Greg Williams
Browse files

Re-enabled in-memory logging.

Tweaked bandwidth measurement for better accuracy.
Updated overlapped write test to use WRITEBACK mode instead of WRITETHROUGH.
parent 06c8aec8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
#include <stdarg.h>

#define KINETIC_LOGGER_DISABLED false
#define KINETIC_LOGGER_FLUSH_THREAD_ENABLED false
#define KINETIC_LOGGER_FLUSH_THREAD_ENABLED true
#define KINETIC_LOG_FILE "kinetic.log"

void KineticLogger_Init(const char* logFile, int log_level);
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ uint8_t data[KINETIC_OBJ_SIZE];

void SystemTestSetup(SystemTestFixture* fixture)
{
    KineticClient_Init("stdout", 3);
    KineticClient_Init("stdout", 2);

    TEST_ASSERT_NOT_NULL_MESSAGE(fixture, "System test fixture is NULL!");

+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

#ifndef SYSTEM_TEST_HOST
#define SYSTEM_TEST_HOST "localhost"
// #define SYSTEM_TEST_HOST "10.138.123.65"
#endif

typedef struct _SystemTestFixture {
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ void* kinetic_put(void* kinetic_arg)
        );

        // Set operation-specific attributes
        entry->synchronization = KINETIC_SYNCHRONIZATION_WRITETHROUGH;
        entry->synchronization = KINETIC_SYNCHRONIZATION_WRITEBACK;

        // Store the data slice
        LOGF1("  *** Storing a data slice (%zu bytes)", entry->value.bytesUsed);
+10 −7
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ void test_Delete_old_object_if_exists(void)
    }
}


#if 0
void test_Put_should_create_new_object_on_device(void)
{
    LOG_LOCATION;
@@ -326,7 +326,9 @@ void test_Put_should_be_able_to_store_max_sized_entry(void)
    TEST_ASSERT_EQUAL_ByteBuffer(KeyBuffer, Entry.key);
    TEST_ASSERT_ByteBuffer_NULL(Entry.newVersion);
}
#endif

#if 1
typedef struct _TestPutClientDataStruct {
    bool called;
    int callbackCount;
@@ -380,16 +382,16 @@ void test_Put_should_use_asynchronous_mode_if_closure_specified(void)
    KineticStatus status = KineticClient_Put(Fixture.handle, &Entry, &closure);
    TEST_ASSERT_EQUAL_KineticStatus(KINETIC_STATUS_SUCCESS, status);

    const long maxWaitMillisecs = 500;
    long millisecsWaiting = 0;
    struct timespec sleepDuration = {.tv_nsec = 1000000};
    const long maxWaitMicrosecs = 2000000;
    long microsecsWaiting = 0;
    struct timespec sleepDuration = {.tv_nsec = 500000};
    while(!TestPutClientData.called) {
        TEST_ASSERT_TRUE_MESSAGE(millisecsWaiting < maxWaitMillisecs, "Timed out waiting to receive PUT async callback!");
        TEST_ASSERT_TRUE_MESSAGE(microsecsWaiting < maxWaitMicrosecs, "Timed out waiting to receive PUT async callback!");
        nanosleep(&sleepDuration, NULL);
        millisecsWaiting += (sleepDuration.tv_nsec / 1000000);
        microsecsWaiting += (sleepDuration.tv_nsec / 1000);
    }

    LOGF0("PUT Response Time = %d ms", millisecsWaiting);
    LOGF0("PUT Response Time = %.1f ms", microsecsWaiting / 1000.0f);

    TEST_ASSERT_EQUAL(1, TestPutClientData.callbackCount);
    TEST_ASSERT_EQUAL(100, TestPutClientData.bytesWritten);
@@ -398,6 +400,7 @@ void test_Put_should_use_asynchronous_mode_if_closure_specified(void)
    TEST_ASSERT_EQUAL_ByteBuffer(KeyBuffer, Entry.key);
    TEST_ASSERT_ByteBuffer_NULL(Entry.newVersion);
}
#endif

/*******************************************************************************
* ENSURE THIS IS AFTER ALL TESTS IN THE TEST SUITE