summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Huerner <ingo.huerner@xse.de>2014-09-09 11:49:47 +0200
committerIngo Huerner <ingo.huerner@xse.de>2014-09-09 11:49:47 +0200
commit50cb5d59abac16c76236706c7b57935767db57f2 (patch)
treebae47a59cfeb5f9734147eb9757f0679418db011
parentbafec6bb5d67b102eae914c1c7b7ad82ace3f001 (diff)
downloadpersistence-client-library-50cb5d59abac16c76236706c7b57935767db57f2.tar.gz
Bugfix in pfs test
-rwxr-xr-xtest/pers_pfs_test_starter.sh4
-rw-r--r--test/persistence_pfs_test.c29
2 files changed, 21 insertions, 12 deletions
diff --git a/test/pers_pfs_test_starter.sh b/test/pers_pfs_test_starter.sh
index 87b194b..4f5ce98 100755
--- a/test/pers_pfs_test_starter.sh
+++ b/test/pers_pfs_test_starter.sh
@@ -39,7 +39,7 @@ else
numLoops=10000000
fi
-/usr/bin/persistence_pfs_test "-l $numLoops"
+/usr/bin/persistence_pfs_test "-l $numLoops" "-s/dev/ttyUSB0"
# get the return value of the test app
rval=$?
@@ -52,4 +52,4 @@ if [ "$rval" == 1 ]
fi
-echo "End of persistence power fail save test" \ No newline at end of file
+echo "End of persistence power fail save test" \ No newline at end of file
diff --git a/test/persistence_pfs_test.c b/test/persistence_pfs_test.c
index 8b949e1..8fe1a1e 100644
--- a/test/persistence_pfs_test.c
+++ b/test/persistence_pfs_test.c
@@ -318,6 +318,7 @@ int main(int argc, char *argv[])
{
int rVal = EXIT_SUCCESS;
int ttyfd = -1;
+ char ttydevice[24] = {0};
unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
pthread_t gMainLoopThread;
struct sched_param param;
@@ -329,20 +330,16 @@ int main(int argc, char *argv[])
DLT_REGISTER_CONTEXT(gPFSDLTContext,"PFS","Context for PCL PFS test logging");
if (argc < 2) {
- printf ("Please start with %s /dev/ttyS1 (for example)\n", argv[0]);
+ printf ("Please start with %s /dev/ttyS1 or /dev/ttyUSB0 (for example)\n", argv[0]);
return EXIT_SUCCESS;
}
- // setup the serial connection to the power supply
- ttyfd = setup_serial_con(argv[1]);
- if(ttyfd == -1)
- {
- printf("Failed to setup serial console: %s\n", argv[0]);
- return EXIT_SUCCESS;
- }
-
pthread_mutex_lock(&gPowerDownMtx); // lock power down mutex and release when powser should be cut off
+
+ // default serial console
+ strncpy(ttydevice, "/dev/ttyUSB0", 24);
+
#if 0
// mount persistence partitions
if(-1 != mount_persistence("/dev/sdb") )
@@ -350,16 +347,28 @@ int main(int argc, char *argv[])
#endif
int numLoops = 1000000, opt = 0;
- while ((opt = getopt(argc, argv, "l:")) != -1)
+ while ((opt = getopt(argc, argv, "l:s:")) != -1)
{
switch (opt)
{
case 'l':
numLoops = atoi(optarg);
break;
+ case 's':
+ memset(ttydevice, 0, 24);
+ strncpy(ttydevice, optarg, 24);
+ break;
}
}
+ // setup the serial connection to the power supply
+ ttyfd = setup_serial_con(ttydevice);
+ if(ttyfd == -1)
+ {
+ printf("Failed to setup serial console: \"%s\"\n", ttydevice);
+ return EXIT_SUCCESS;
+ }
+
if(update_test_progress_flag(gTestInProgressFlag, &gLifecycleCounter) == 0)
{
printf("PFS test - first lifecycle, setup test data\n");