summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIngo Huerner <ingo_huerner@mentor.com>2017-03-07 10:32:32 +0100
committerIngo Huerner <ingo_huerner@mentor.com>2017-03-07 10:32:32 +0100
commit0c7939b0c1725224ff85827a8e44eb1e23dcd40b (patch)
treea79419fc4eceb91d78862f76aee9191a8216561a /test
parente88cdcdee8aa92d62b6a77ed1e938afb107229f4 (diff)
downloadpersistence-client-library-0c7939b0c1725224ff85827a8e44eb1e23dcd40b.tar.gz
Added pclCustomLibConfigFileTest.cfg.in config file for tests.
Removed in pclCustomLibConfigFile.cfg.in entries for test plugins. Replaced sync call by syncfs (process_prepare_shutdown function). Removed some unnecessary close calls (findings static code analysis tool).
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am9
-rw-r--r--test/persistence_client_library_benchmark.c628
-rw-r--r--test/persistence_client_library_test.c32
-rw-r--r--test/persistence_client_library_test_file.c22
4 files changed, 672 insertions, 19 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 4328697..477532f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -10,10 +10,11 @@ endif
noinst_PROGRAMS = persistence_client_library_test \
persistence_client_library_test_file \
- persistence_client_library_dbus_test
+ persistence_client_library_dbus_test \
+ persistence_client_library_benchmark
persistence_client_library_dbus_test_SOURCES = persistence_client_library_dbus_test.c
-persistence_client_library_dbus_test_LDADD = $(DEPS_LIBS) \
+persistence_client_library_dbus_test_LDADD = $(DEPS_LIBS) \
$(top_builddir)/src/libpersistence_client_library.la
persistence_client_library_test_SOURCES = persistence_client_library_test.c
@@ -24,6 +25,10 @@ persistence_client_library_test_file_SOURCES = persistence_client_library_test_f
persistence_client_library_test_file_LDADD = $(DEPS_LIBS) $(CHECK_LIBS) \
$(top_builddir)/src/libpersistence_client_library.la
+persistence_client_library_benchmark_SOURCES = persistence_client_library_benchmark.c
+persistence_client_library_benchmark_LDADD = $(DEPS_LIBS) $(CHECK_LIBS) \
+ $(top_builddir)/src/libpersistence_client_library.la
+
TESTS=persistence_client_library_test persistence_client_library_test_file
diff --git a/test/persistence_client_library_benchmark.c b/test/persistence_client_library_benchmark.c
new file mode 100644
index 0000000..3c48469
--- /dev/null
+++ b/test/persistence_client_library_benchmark.c
@@ -0,0 +1,628 @@
+/******************************************************************************
+ * Project Persistency
+ * (c) copyright 2014
+ * Company XS Embedded GmbH
+ *****************************************************************************/
+/******************************************************************************
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
+ * with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+******************************************************************************/
+ /**
+ * @file persistence_client_library_benchmark.c
+ * @ingroup Persistence client library benchmark
+ * @author Ingo Huerner
+ * @brief Benchmark of persistence client library
+ * @see
+ */
+
+#include "../include/persistence_client_library_key.h"
+#include "../include/persistence_client_library_file.h"
+#include "../include/persistence_client_library_error_def.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h> /* atoi */
+
+#include <dlt.h>
+#include <dlt_common.h>
+
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <pthread.h>
+
+
+#define SECONDS2NANO 1000000000L
+#define NANO2MIL 1000000L
+#define MIL2SEC 1000L
+
+#define BUFFER_SIZE 2048
+
+// define for the used clock: "CLOCK_MONOTONIC" or "CLOCK_REALTIME"
+#define CLOCK_ID CLOCK_MONOTONIC
+
+const char* gAppName = "lt-persistence_client_library_test";
+
+extern const char* gWriteBuffer;
+extern const char* gWriteBuffer2;
+
+
+double gDurationMsWrite = 0, gSizeMbWrite = 0;
+double gAverageBytesWrite = 0, gAverageTimeWrite = 0;
+double gAverageBytesWriteSecond = 0, gAverageTimeWriteSecond = 0;
+double gDurationRead = 0, gSizeRead = 0;
+double gDurationReadSecond = 0, gSizeReadSecond = 0;
+double gDurationInit = 0, gDurationDeinit = 0;
+
+
+inline long long getNsDuration(struct timespec* start, struct timespec* end)
+{
+ return ((end->tv_sec * SECONDS2NANO) + end->tv_nsec) - ((start->tv_sec * SECONDS2NANO) + start->tv_nsec);
+}
+
+
+inline long getMsDuration(struct timespec* start, struct timespec* end)
+{
+ return (((end->tv_sec * SECONDS2NANO) + end->tv_nsec) - ((start->tv_sec * SECONDS2NANO) + start->tv_nsec))/NANO2MIL;
+}
+
+
+
+void init_benchmark(int numLoops)
+{
+ int i = 0;
+ long durationInit = 0;
+ long durationDeInit = 0;
+ struct timespec initStart, initEnd;
+ struct timespec deInitStart, deInitEnd;
+ int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
+
+ for(i=0; i<numLoops; i++)
+ {
+ // init
+ clock_gettime(CLOCK_ID, &initStart);
+ (void)pclInitLibrary(gAppName , shutdownReg);
+ clock_gettime(CLOCK_ID, &initEnd);
+ durationInit += getNsDuration(&initStart, &initEnd);
+
+ // deinit
+ clock_gettime(CLOCK_ID, &deInitStart);
+ (void)pclDeinitLibrary();
+ clock_gettime(CLOCK_ID, &deInitEnd);
+ durationDeInit += getNsDuration(&deInitStart, &deInitEnd);
+ }
+
+ gDurationInit = (double)durationInit/(double)numLoops/(double)NANO2MIL;
+ gDurationDeinit = (double)durationDeInit/(double)numLoops/(double)NANO2MIL;
+}
+
+
+
+void read_benchmark(int numLoops)
+{
+ int ret = 0, i = 0;
+ long duration = 0, size = 0;
+ struct timespec readStart, readEnd;
+ char key[128] = { 0 };
+ unsigned char buffer[7168] = {0}; // 7kB
+ int shutdownReg = PCL_SHUTDOWN_TYPE_NONE;
+
+ (void)pclInitLibrary(gAppName , shutdownReg);
+
+ //
+ // populate data
+ //
+ for(i=0; i<numLoops; i++)
+ {
+ memset(key, 0, 128);
+ snprintf(key, 128, "pos/last_position_w_bench%d",i);
+
+ if(i%2)
+ {
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, key, 10, 10, (unsigned char*)gWriteBuffer, (int)strlen(gWriteBuffer) );
+ }
+ else
+ {
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, key, 10, 10, (unsigned char*)gWriteBuffer2, (int)strlen(gWriteBuffer2) );
+ }
+ }
+ pclLifecycleSet(PCL_SHUTDOWN);
+ (void)pclDeinitLibrary();
+
+
+ //
+ // read data
+ //
+ (void)pclInitLibrary(gAppName , shutdownReg);
+
+ duration = 0;
+ memset(buffer, 0, 7168);
+ size = 0;
+
+ for(i=0; i<numLoops; i++)
+ {
+ memset(key, 0, 128);
+
+ snprintf(key, 128, "pos/last_position_w_bench%d",i);
+
+ clock_gettime(CLOCK_ID, &readStart);
+ ret = pclKeyReadData(PCL_LDBID_LOCAL, key, 10, 10, buffer, 7168);
+ clock_gettime(CLOCK_ID, &readEnd);
+
+ size += ret;
+ duration += getNsDuration(&readStart, &readEnd);
+
+ memset(buffer, 0, 7168);
+ }
+
+ pclLifecycleSet(PCL_SHUTDOWN);
+ (void)pclDeinitLibrary();
+
+ gDurationRead = (double)duration/(double)numLoops;
+ gSizeRead = (double)size/(double)numLoops/(double)1024;
+}
+
+
+void write_benchmark(int numLoops)
+{
+ int ret = 0, i = 0;
+ long duration = 0, size = 0;
+ struct timespec readStart, readEnd;
+ char key[128] = { 0 };
+ unsigned char buffer[7168] = {0}; // 7kB
+
+ int shutdownReg = PCL_SHUTDOWN_TYPE_NONE;
+
+ (void)pclInitLibrary(gAppName , shutdownReg);
+
+ duration = 0;
+ memset(buffer, 0, 7168);
+ size = 0;
+
+ // write the first time to the data
+ for(i=0; i <numLoops; i++)
+ {
+ memset(key, 0, 128);
+ snprintf(key, 128, "pos/last_position_w_bench%d",i);
+
+ if(i%2)
+ {
+ clock_gettime(CLOCK_ID, &readStart);
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, key, 20, 20, (unsigned char*)gWriteBuffer, (int)strlen(gWriteBuffer) );
+ clock_gettime(CLOCK_ID, &readEnd);
+ }
+ else
+ {
+ clock_gettime(CLOCK_ID, &readStart);
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, key, 20, 20, (unsigned char*)gWriteBuffer2, (int)strlen(gWriteBuffer2));
+ clock_gettime(CLOCK_ID, &readEnd);
+ }
+
+ size += ret;
+ duration += getNsDuration(&readStart, &readEnd);
+
+ memset(buffer, 0, 7168);
+ }
+ gAverageBytesWrite = (double)size/(double)numLoops/(double)1024;
+ gAverageTimeWrite = (double)duration/(double)numLoops;
+
+
+ // write the second time to the data
+ duration = 0;
+ size = 0;
+ for(i=0; i <numLoops; i++)
+ {
+ memset(key, 0, 128);
+ snprintf(key, 128, "pos/last_position_w_bench%d",i);
+
+ if(i%2)
+ {
+ clock_gettime(CLOCK_ID, &readStart);
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, key, 20, 20, (unsigned char*)gWriteBuffer2, (int)strlen(gWriteBuffer2) );
+ clock_gettime(CLOCK_ID, &readEnd);
+ }
+ else
+ {
+ clock_gettime(CLOCK_ID, &readStart);
+ ret = pclKeyWriteData(PCL_LDBID_LOCAL, key, 20, 20, (unsigned char*)gWriteBuffer, (int)strlen(gWriteBuffer));
+ clock_gettime(CLOCK_ID, &readEnd);
+ }
+
+ size += ret;
+ duration += getNsDuration(&readStart, &readEnd);
+
+ memset(buffer, 0, 7168);
+ }
+ gAverageBytesWriteSecond = (double)size/(double)numLoops/(double)1024;
+ gAverageTimeWriteSecond = (double)duration/(double)numLoops;
+
+
+ // measure the write back time
+ duration = 0;
+
+ clock_gettime(CLOCK_ID, &readStart);
+ pclLifecycleSet(PCL_SHUTDOWN);
+ clock_gettime(CLOCK_ID, &readEnd);
+
+ duration = getNsDuration(&readStart, &readEnd);
+ gDurationMsWrite = (double)duration/(double)NANO2MIL;
+ // B to kB - kB to MB
+ gSizeMbWrite = (double)size/(double)1024/(double)1024;
+
+
+ (void)pclDeinitLibrary();
+}
+
+
+
+void printAppManual()
+{
+ printf("\n\n==================================================================================\n");
+ printf("NAME\n");
+ printf(" ./persistence_client_library_benchmark - run PCL benchmarks");
+
+ printf("\nSYNOPSIS\n");
+ printf(" persistence_client_library_benchmark [-l loop] [-irwh]\n");
+
+ printf("\nDESCRIPTION\n");
+ printf(" Run persistence client library benchmarks.\n");
+ printf(" If no option is passed, all benchmarks are run with default (1024) number of loops.\n");
+
+ printf("\nOPTIONS\n");
+ printf(" -l number of loops for each test (init benchmark is bound to 10 loops)\n");
+ printf(" -i Run init/deinit benchmarks\n");
+ printf(" -r Run read benchmarks\n");
+ printf(" -w Run write benchmarks\n");
+ printf(" -h Display this help\n");
+ printf("==================================================================================\n");
+}
+
+
+
+int main(int argc, char *argv[])
+{
+ int ret = 0;
+
+ int numLoops = 1024; // number of default loops
+ long long resolution = 0;
+
+ struct timespec clockRes;
+
+ int opt = 0, doInit = 0, doRead = 0, doWrite = 0, printManual = 0;
+
+ const char* envVariable = "PERS_CLIENT_LIB_CUSTOM_LOAD";
+
+ setenv(envVariable, "/etc/pclCustomLibConfigFileTest.cfg", 1);
+
+ if(argc <= 1)
+ {
+ // if no parameter, run all tests with default loops
+ doInit = 1;
+ doRead = 1;
+ doWrite = 1;
+ printManual = 1;
+ }
+
+
+ while ((opt = getopt(argc, argv, "l:irwh")) != -1)
+ {
+ switch (opt)
+ {
+ case 'l':
+ numLoops = atoi(optarg);
+ break;
+ case 'i':
+ doInit = 1;
+ break;
+ case 'r':
+ doRead = 1;
+ break;
+ case 'w':
+ doWrite = 1;
+ break;
+ case 'h':
+ printManual = 1;
+ break;
+ }
+ }
+
+ /// debug log and trace (DLT) setup
+ DLT_REGISTER_APP("PCLb","tests the persistence client library");
+
+ clock_getres(CLOCK_ID, &clockRes);
+ resolution = ((clockRes.tv_sec * SECONDS2NANO) + clockRes.tv_nsec);
+
+ //
+ // run benchmarks
+ //
+
+ if(doInit == 1)
+ init_benchmark(10); // static number of loops, otherwise it takes to long
+
+ if(doRead == 1)
+ read_benchmark(numLoops);
+
+ if(doWrite == 1)
+ write_benchmark(numLoops);
+
+
+ if(printManual == 1)
+ {
+ printAppManual();
+ }
+
+ printf("\n\n==================================================================================\n");
+ printf(" PCL benchmark - num loop: %d - clock resolution: %f\n", numLoops, (double)((double)resolution));
+ printf("==================================================================================\n");
+ if(doInit == 1)
+ {
+ printf("Init benchmark\n");
+ printf(" Init => %.2f ms \n", gDurationInit);
+ printf(" Deinit => %.2f ms \n", gDurationDeinit);
+ }
+ else
+ {
+ printf("Init benchmark - not activated.\n");
+ }
+ printf("==================================================================================\n");
+ if(doRead == 1)
+ {
+ printf("Read benchmark\n");
+ printf(" Read => %.0f ns for \t [%.2f Kilobytes item]\n", gDurationRead, gSizeRead);
+ printf(" Read => %.0f ns for \t [1 Kilobyte item]\n", (double)gDurationRead/(double)gSizeRead);
+ }
+ else
+ {
+ printf("Read benchmark - not activated.\n");
+ }
+ printf("==================================================================================\n");
+ if(doWrite == 1)
+ {
+ printf("Write benchmark\n");
+ printf(" Write 1. => %.0f ns for \t [%.2f Kilobytes item]\n", gAverageTimeWrite, gAverageBytesWrite);
+ printf(" Write 2. => %.0f ns for \t [%.2f Kilobytes item]\n", gAverageTimeWriteSecond, gAverageBytesWriteSecond);
+ printf(" Write 1. => %.0f ns for \t [1 Kilobyte item]\n", gAverageTimeWrite/gAverageBytesWrite);
+ printf(" Write 2. => %.0f ns for \t [1 Kilobyte item]\n", gAverageTimeWriteSecond/gAverageBytesWriteSecond);
+ printf(" Writeback => %.3f ms for \t [%.2f Megabytes item]\n", gDurationMsWrite, gSizeMbWrite);
+ printf(" Writeback => %.3f ms for \t [1 Megabyte item]\n", (double)gDurationMsWrite/(double)gSizeMbWrite);
+
+ printf("Explanation:\n");
+ printf(" Writing the first time (1.) to an item takes more time.\n");
+ printf(" As we use the copy an write procedure, we create an entry for this item \n");
+ printf(" in the cache and are writing then to the cache.\n");
+ printf(" Further writes (2.) are faster.\n");
+ printf(" When the database will be close, all modified items will be written back\n");
+ printf(" to non-volatile memory device.\n");
+ }
+ else
+ {
+ printf("Write benchmark - not activated.\n");
+ }
+ printf("==================================================================================\n");
+
+ // unregister debug log and trace
+ DLT_UNREGISTER_APP();
+
+ dlt_free();
+
+ return ret;
+}
+
+
+
+const char* gWriteBuffer =
+ "---------> F I R S T write buffer starting block "
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste""Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "F I R S T write buffer ending block <---------";
+
+const char* gWriteBuffer2 =
+ "---------> S E C O N D write buffer starting block "
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste""Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "Pack my box with five dozen liquor jugs. - "
+ "Jackdaws love my big sphinx of quartz. - "
+ "The five boxing wizards jump quickly. - "
+ "How vexingly quick daft zebras jump! - "
+ "Bright vixens jump; dozy fowl quack - "
+ "Sphinx of black quartz, judge my vow"
+ "Voyez le brick géant que j’examine près du wha"
+ "Zornig und gequält rügen jeweils Pontifex und Volk die maßlose bischöfliche Hybris"
+ "Xaver schreibt für Wikipedia zum Spaß quälend lang über Yoga, Soja und Öko"
+ "Polyfon zwitschernd aßen Mäxchens Vögel Rüben, Joghurt und Quark"
+ "Fix, Schwyz!“ quäkt Jürgen blöd vom Paß"
+ "Welch fieser Katzentyp quält da süße Vögel bloß zum Jux"
+ "Die heiße Zypernsonne quälte Max und Victoria ja böse auf dem Weg bis zur Küste"
+ "S E C O N D write buffer ending block <---------";
+
+
+
diff --git a/test/persistence_client_library_test.c b/test/persistence_client_library_test.c
index c9556ce..ad7ad8a 100644
--- a/test/persistence_client_library_test.c
+++ b/test/persistence_client_library_test.c
@@ -80,6 +80,10 @@ void run_concurrency_test();
void data_setup(void)
{
int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
+ const char* envVariable = "PERS_CLIENT_LIB_CUSTOM_LOAD";
+
+ setenv(envVariable, "/etc/pclCustomLibConfigFileTest.cfg", 1);
+
(void)pclInitLibrary(gTheAppId, shutdownReg);
}
@@ -805,6 +809,11 @@ START_TEST(test_InitDeinit)
pclDeinitLibrary();
+ pclInitLibrary("NodeStateManager", PCL_SHUTDOWN_TYPE_NONE);
+
+ pclDeinitLibrary();
+
+
}
END_TEST
@@ -1158,7 +1167,13 @@ START_TEST(test_NoRct)
DLT_LOG(gPcltDLTContext, DLT_LOG_INFO, DLT_STRING("PCL_TEST test_NoRct"));
ret = pclKeyWriteData(PCL_LDBID_LOCAL, "someResourceId", 0, 0, (unsigned char*)writeBuffer, (int)strlen(writeBuffer));
+
+#if USE_APPCHECK
+ fail_unless(ret == EPERS_SHUTDOWN_NO_TRUSTED, "Shutdown is trusted, but should not");
+#else
fail_unless(ret == EPERS_NOPRCTABLE, "RCT available, but should not");
+#endif
+
}
END_TEST
@@ -1458,12 +1473,11 @@ START_TEST(test_NoPluginFunc)
// change to an wrong plugin configuration file using environment variable
setenv(envVariable, "/etc/pclCustomLibConfigFileWrongDefault.cfg", 1);
- sleep(3);
+ sleep(2);
(void)pclInitLibrary(gTheAppId, shutdownReg); // use the app id, the resource is registered for
ret = pclKeyReadData(PCL_LDBID_LOCAL, "status/open_document", 3, 2, buffer, READ_SIZE);
- printf("*** ret: %d\n", ret);
ck_assert_int_eq(ret, EPERS_COMMON);
ret = pclKeyGetSize(PCL_LDBID_LOCAL, "status/open_document", 3, 2);
@@ -1601,13 +1615,16 @@ static Suite * persistenceClientLib_suite()
tcase_set_timeout(tc_MultiThreadedWrite, 20);
#endif
+
+
+ suite_add_tcase(s, tc_NoPluginFunc);
+
suite_add_tcase(s, tc_persSetData);
tcase_add_checked_fixture(tc_persSetData, data_setup, data_teardown);
suite_add_tcase(s, tc_persGetData);
tcase_add_checked_fixture(tc_persGetData, data_setup, data_teardown);
-
suite_add_tcase(s, tc_persGetDataHandle);
tcase_add_checked_fixture(tc_persGetDataHandle, data_setup, data_teardown);
@@ -1663,18 +1680,15 @@ static Suite * persistenceClientLib_suite()
suite_add_tcase(s, tc_InitDeinit);
- //suite_add_tcase(s, tc_NoPluginFunc);
-
- //suite_add_tcase(s, tc_SharedData);
- //tcase_add_checked_fixture(tc_SharedData, data_setup, data_teardown);
+ suite_add_tcase(s, tc_SharedData);
+ tcase_add_checked_fixture(tc_SharedData, data_setup, data_teardown);
#if USE_APPCHECK
suite_add_tcase(s, tc_ValidApplication);
-#else
-
#endif
+
#if 0
suite_add_tcase(s, tc_PAS_DbusInterface);
tcase_add_checked_fixture(tc_PAS_DbusInterface, data_setup, data_teardown);
diff --git a/test/persistence_client_library_test_file.c b/test/persistence_client_library_test_file.c
index 27a3bba..06fdf9e 100644
--- a/test/persistence_client_library_test_file.c
+++ b/test/persistence_client_library_test_file.c
@@ -92,14 +92,6 @@ void data_setup_browser(void)
}
-void data_setup_norct(void)
-{
- int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
-
- (void)pclInitLibrary("norct", shutdownReg);
-}
-
-
void data_teardown(void)
{
pclDeinitLibrary();
@@ -1834,6 +1826,17 @@ void doListTest()
}
+void doPclInitTest()
+{
+ int rval = pclInitLibrary(gTheAppId, PCL_SHUTDOWN_TYPE_NORMAL);
+
+ printf("Wait until a key has been pressed - return: %d\n", rval);
+ getchar();
+
+
+ pclDeinitLibrary();
+}
+
int main(int argc, char *argv[])
{
int nr_failed = 0;
@@ -1879,6 +1882,9 @@ int main(int argc, char *argv[])
case 1:
doListTest();
break;
+ case 2:
+ doPclInitTest();
+ break;
default:
printf("invalid parameter\n");
break;