Commit cfefe8d1 authored by seokheegit's avatar seokheegit
Browse files

Merge pull request #14 from seokheegit/develop-warningfix

Fix compile warning for pointer target type.
parents fd6b3e9d ec950dc0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -377,7 +377,7 @@ $(SYSTEST_OUT)/run_%: $(SYSTEST_SRC)/%.c $(SYSTEST_OUT)/%_runner.c $(KINETIC_LIB
	@echo ================================================================================
	@echo System test: '$<'
	@echo --------------------------------------------------------------------------------
	$(CC) -o $@ $< $(word 2,$^) ./test/support/system_test_fixture.c $(UNITY_SRC) $(SYSTEST_CFLAGS) $(LIB_INCS) -I$(UNITY_INC) -I./test/support $(SYSTEST_LDFLAGS) $(KINETIC_LIB)
	$(CC) -o $@ $< $(word 2,$^) ./test/support/system_test_fixture.c ./test/support/system_test_kv_generate.c $(UNITY_SRC) $(SYSTEST_CFLAGS) $(LIB_INCS) -I$(UNITY_INC) -I./test/support $(SYSTEST_LDFLAGS) $(KINETIC_LIB)

$(SYSTEST_OUT)/%.testpass : $(SYSTEST_OUT)/run_%
	./scripts/runSystemTest.sh $*
+10 −1
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@
#include "kinetic_admin_client.h"

SystemTestFixture Fixture = {.connected = false};
static char InitPinData[8];
static ByteArray InitPin;

static void LoadConfiguration(void)
{
@@ -158,10 +160,17 @@ int GetSystemTestTlsPort2(void)
    return Fixture.tlsPort2;
}

void SystemTestSetup(int log_level)
void SystemTestSetup(int log_level, bool secure_erase)
{
    const uint8_t *key = (const uint8_t *)SESSION_HMAC_KEY;
    SystemTestSetupWithIdentity(log_level, SESSION_IDENTITY, key, strlen((const char*)key));

    if (secure_erase)
    {
        InitPin = ByteArray_Create(InitPinData, 0);
        KineticStatus status = KineticAdminClient_SecureErase(Fixture.adminSession, InitPin);
    	TEST_ASSERT_EQUAL_KineticStatus(KINETIC_STATUS_SUCCESS, status);
    }
}

void SystemTestSetupWithIdentity(int log_level, int64_t identity,
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ typedef struct _SystemTestFixture {

extern SystemTestFixture Fixture;

void SystemTestSetup(int log_level);
void SystemTestSetup(int log_level, bool secure_erase);
void SystemTestSetupWithIdentity(int log_level, int64_t identity,
    const uint8_t *key, size_t key_size);
void SystemTestShutDown(void);
+59 −0
Original line number Diff line number Diff line
/*
* kinetic-c
* Copyright (C) 2015 Seagate Technology.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "system_test_kv_generate.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>

static const int MAX_SIZE = 1024;
static const char KEY_PREFIX[] = "my_key";
static const char VALUE_PREFIX[] = "my_value";

ByteBuffer generate_entry_key_by_index(uint32_t index)
{
	char* key = malloc(MAX_SIZE);
	return ByteBuffer_CreateAndAppendFormattedCString(key, MAX_SIZE, "%s%10d",KEY_PREFIX, index);
}

ByteBuffer generate_entry_value_by_index(uint32_t index)
{
	char* value = malloc(MAX_SIZE);
	return ByteBuffer_CreateAndAppendFormattedCString(value, MAX_SIZE, "%s%10d",VALUE_PREFIX, index);
}

ByteBuffer get_generated_value_by_key(ByteBuffer* key)
{
	assert(key != NULL);
	assert(key->array.data != NULL);
	assert(key->bytesUsed > 0);
	assert(key->array.len > 0);
	//assert(strncmp(key->array.data, KEY_PREFIX, strlen(KEY_PREFIX)) == 0);

	ByteBuffer value_buffer;
	char* value = malloc(MAX_SIZE);
	sprintf(value, "%s%s", VALUE_PREFIX, key->array.data + strlen(KEY_PREFIX));

	value_buffer.array.data = (uint8_t *)value;
	value_buffer.array.len = strlen(value);
	value_buffer.bytesUsed = value_buffer.array.len;

    return value_buffer;
}
+30 −0
Original line number Diff line number Diff line
/*
* kinetic-c
* Copyright (C) 2015 Seagate Technology.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef _SYSTEM_TEST_KV_GENERATE
#define _SYSTEM_TEST_KV_GENERATE

#include <stdint.h>
#include "byte_array.h"

ByteBuffer generate_entry_key_by_index(uint32_t index);
ByteBuffer generate_entry_value_by_index(uint32_t index);
ByteBuffer get_generated_value_by_key(ByteBuffer* key);

#endif  //_UNITY_KV_GENERATE
Loading