Commit 261e685b authored by Greg Williams's avatar Greg Williams
Browse files

Got operations working again after accounting for accounting for lack of...

Got operations working again after accounting for accounting for lack of instant secure erase on Java simulator. Need to fix a couple of tests still.
parent 959593b5
Loading
Loading
Loading
Loading
+31 −7
Original line number Diff line number Diff line
@@ -159,6 +159,28 @@ uninstall:
	$(RM) -f $(PREFIX)/include/protobuf-c.h


#===============================================================================
# Java Simulator Support
#===============================================================================

update_simulator:
	cd vendor/kinetic-java; mvn clean package; cd -
	cp vendor/kinetic-java/kinetic-simulator/target/*.jar vendor/kinetic-java-simulator/

start_simulator:
	./vendor/kinetic-simulator/startSimulator.sh &
	sleep 4

erase_simulator: start_simulator
	./vendor/kinetic-simulator/eraseSimulator.sh
	sleep 1

stop_simulator:
	./vendor/kinetic-simulator/stopSimulator.sh

.PHONY: start_simulator erase_simulator stop_simulator


#===============================================================================
# Test Utility Build Support
#===============================================================================
@@ -192,17 +214,19 @@ CLASSPATH = $(JAVA_HOME)/lib/tools.jar:$(SIM_JARS_PREFIX)-jar-with-dependencies.
SIM_RUNNER = com.seagate.kinetic.simulator.internal.SimulatorRunner
SIM_ADMIN = com.seagate.kinetic.admin.cli.KineticAdminCLI

run: $(UTIL_EXEC)
run: $(UTIL_EXEC) start_simulator
	@echo
	@echo --------------------------------------------------------------------------------
	@echo Running test utility: $(UTIL_EXEC)
	@echo --------------------------------------------------------------------------------
	@sleep 2
	exec java -classpath "$(CLASSPATH)" $(SIM_RUNNER) "$@" &
	@sleep 5
	exec java -classpath "$(CLASSPATH)" $(SIM_ADMIN) -setup -erase true
	$(UTIL_EXEC) noop put get delete
	exec pkill -f 'java.*kinetic-simulator'
	@echo
	$(UTIL_EXEC) noop
	exec $(UTIL_EXEC) put
	exec $(UTIL_EXEC) get
	exec $(UTIL_EXEC) delete
	exec $(UTIL_EXEC) put get delete
	@echo
	@echo Test Utility integration tests w/ kinetic-c lib passed!
	@echo
	@echo Stopping simulator...
	./vendor/kinetic-simulator/stopSimulator.sh
+14 −10
Original line number Diff line number Diff line
@@ -3,12 +3,16 @@ require 'kinetic-ruby'
compiler = ENV.fetch('CC', 'gcc')
compiler_location = `which #{compiler}`.strip
compiler_info = `#{compiler} --version 2>&1`.strip
puts "" +
"Configuration:\n" +


task :report_toolchain do
  report_banner("Toolchain Configuration")
  report "" +
    "  compiler:\n" +
    "    location: #{compiler_location}\n" +
    "    info:\n" +
"      " + compiler_info.gsub(/\n/, "\n      ") + "\n\n"
    "      " + compiler_info.gsub(/\n/, "\n      ") + "\n"
end

KineticRuby::Rake::load_tasks
require 'ceedling'
@@ -60,12 +64,12 @@ task :proto => [PROTO_OUT] do

  report_banner "Building protobuf v2.5.0"
  cd PROTOBUF_CORE do
    execute_command "./configure --disable-shared; make; make check; make install"
    execute_command "./configure --disable-shared; make; make check; sudo make install"
  end

  report_banner "Building protobuf-c and installing protoc-c"
  cd PROTOBUF_C do
    execute_command "./autogen.sh && ./configure && make && make install"
    execute_command "./autogen.sh && ./configure && make && sudo make install"
    protoc_c = `which protoc-c`
    raise "Failed to find protoc-c utility" if protoc_c.strip.empty?
    versions = `protoc-c --version`
@@ -140,7 +144,7 @@ namespace :java_sim do
    java_sim_cleanup

    # Find the java simulator jar
    jars = Dir["vendor/kinetic-java/kinetic-simulator*.jar"]
    jars = Dir["vendor/kinetic-simulator/kinetic-simulator*.jar"]
    raise "No Kinetic Java simulator .jar files found!" if jars.empty?

    # Configure the classpath
@@ -368,7 +372,7 @@ namespace :tests do

end

task :test_all => ['tests:unit', 'tests:integration', 'tests:system']
task :test_all => ['report_toolchain', 'tests:unit', 'tests:integration', 'tests:system']

desc "Build all and run test utility"
task :all => ['test_all']
+11 −11
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@
 * `NULL`-terminated.
 */
typedef struct _ByteArray {
    size_t len;     /**< Number of bytes in the `data` field. */
    uint8_t* data;  /**< Pointer to an allocated array of data bytes. */
    const size_t  len;    /**< Number of bytes in the `data` field. */
    uint8_t* const data;  /**< Pointer to an allocated array of data bytes. */
} ByteArray;

/** @brief Convenience macro to represent an empty array with no data */
@@ -22,8 +22,8 @@ typedef struct _ByteArray {

ByteArray ByteArray_Create(void* data, size_t len);
ByteArray ByteArray_CreateWithCString(char* str);
void ByteArray_FillWithDummyData(const ByteArray array);
ByteArray ByteArray_GetSlice(const ByteArray array, size_t start, size_t len);
void ByteArray_FillWithDummyData(const ByteArray array);

/**
 * @brief Structure for an embedded ByteArray as a buffer
@@ -32,21 +32,21 @@ ByteArray ByteArray_GetSlice(const ByteArray array, size_t start, size_t len);
 * byte is consumed, but shall not exceed the `array` length
 */
typedef struct {
    ByteArray array;     /**< ByteArray holding allocated array w/length = allocated size */
    const ByteArray array;     /**< ByteArray holding allocated array w/length = allocated size */
    size_t          bytesUsed; /**< Reflects the number of bytes used from the `array` */
} ByteBuffer;

/** @brief Convenience macro to represent an empty buffer with no data */
#define BYTE_BUFFER_NONE (ByteBuffer){.array = BYTE_ARRAY_NONE, .bytesUsed = 0}
#define BYTE_BUFFER_NONE (ByteBuffer){.array = BYTE_ARRAY_NONE}

ByteBuffer ByteBuffer_Create(void* data, size_t max_len);
ByteBuffer ByteBuffer_Create(void* data, size_t max_len, size_t used);
ByteBuffer ByteBuffer_CreateWithArray(ByteArray array);
void ByteBuffer_Reset(ByteBuffer* buffer);
long ByteBuffer_BytesRemaining(const ByteBuffer buffer);
ByteArray ByteBuffer_Consume(ByteBuffer* buffer, size_t len);
bool ByteBuffer_Append(ByteBuffer* buffer, const void* data, size_t len);
bool ByteBuffer_AppendArray(ByteBuffer* buffer, const ByteArray array);
bool ByteBuffer_AppendCString(ByteBuffer* buffer, const char* data);
bool ByteBuffer_AppendDummyData(ByteBuffer* buffer, size_t len);
ByteBuffer* ByteBuffer_Append(ByteBuffer* buffer, const void* data, size_t len);
ByteBuffer* ByteBuffer_AppendArray(ByteBuffer* buffer, const ByteArray array);
ByteBuffer* ByteBuffer_AppendCString(ByteBuffer* buffer, const char* data);
ByteBuffer* ByteBuffer_AppendDummyData(ByteBuffer* buffer, size_t len);

#endif // _BYTE_ARRAY_H
+3 −1
Original line number Diff line number Diff line
@@ -143,8 +143,10 @@ typedef enum {
    KINETIC_STATUS_INVALID_REQUEST,     // Something about the request is invalid
    KINETIC_STATUS_OPERATION_INVALID,   // Operation was invalid
    KINETIC_STATUS_OPERATION_FAILED,    // Device reported an operation error
    KINETIC_STATUS_VERSION_FAILURE,     // Basically a VERSION_MISMATCH error for a PUT
    KINETIC_STATUS_CLUSTER_MISMATCH,    // Specified cluster version does not match device
    KINETIC_STATUS_VERSION_MISMATCH,    // The specified object version info for a PUT/GET do not match stored object
    KINETIC_STATUS_DATA_ERROR,          // Device reported data error, no space or HMAC failure
    KINETIC_STATUS_NOT_FOUND,           // The requested object does not exist
    KINETIC_STATUS_BUFFER_OVERRUN,      // One or more of byte buffers did not fit all data
    KINETIC_STATUS_MEMORY_ERROR,        // Failed allocating/deallocating memory
    KINETIC_STATUS_SOCKET_TIMEOUT,      // A timeout occurred while waiting for a socket operation
+3 −5
Original line number Diff line number Diff line
@@ -39,19 +39,17 @@ void ByteBuffer_Reset(ByteBuffer* buffer)
    buffer->bytesUsed = 0;
}

ByteBuffer ByteBuffer_Create(void* data, size_t max_len)
ByteBuffer ByteBuffer_Create(void* data, size_t max_len, size_t used)
{
    return (ByteBuffer) {
        .array = (ByteArray) {.data = (uint8_t*)data, .len = max_len},
        .bytesUsed = 0,
        .bytesUsed = used,
    };
}

ByteBuffer ByteBuffer_CreateWithArray(ByteArray array)
{
    return (ByteBuffer) {
        .array = array, .bytesUsed = 0
    };
    return (ByteBuffer) {.array = array, .bytesUsed = 0};
}

long ByteBuffer_BytesRemaining(const ByteBuffer buffer)
Loading