summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2011-09-28 18:24:37 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2011-09-28 18:24:37 +0200
commit966bffa7397f0479640f2232c6a2d1667026952e (patch)
tree1593c54018d6ba6e50faa641000379be98b8d9bc /src/tests
parent76b3293857f63563ae0a98a834591cd9d26353d9 (diff)
parent106dbe47ccd610a6cad2980838498ba8497a249f (diff)
downloadDLT-daemon-966bffa7397f0479640f2232c6a2d1667026952e.tar.gz
Merge branch 'master' of QMUC300924:/home/git/DLT-daemon
Diffstat (limited to 'src/tests')
-rwxr-xr-xsrc/tests/dlt-test-internal.c119
-rwxr-xr-xsrc/tests/dlt-test-stress.c9
2 files changed, 3 insertions, 125 deletions
diff --git a/src/tests/dlt-test-internal.c b/src/tests/dlt-test-internal.c
index 00209f1..02142b9 100755
--- a/src/tests/dlt-test-internal.c
+++ b/src/tests/dlt-test-internal.c
@@ -179,11 +179,6 @@ int main(int argc, char* argv[])
return -1;
}
- if (test[0])
- {
- internal1();
- }
-
printf("\n");
printf("%d tests passed\n",tests_passed);
printf("%d tests failed\n",tests_failed);
@@ -191,117 +186,3 @@ int main(int argc, char* argv[])
return 0;
}
-void internal1(void)
-{
- int index,result_index;
- unsigned int c;
- unsigned int size;
-
- char buf[1024],result[1024];
-
- DltRingBuffer mybuf;
-
- printf("Test1i: Ringbuffer, writing and reading \n");
-
- for (size=8;size<=30;size++)
- {
-
- dlt_ringbuffer_init(&mybuf, size);
-
- memset(result,0,1024);
-
- if (vflag)
- {
- printf("\nRingbuffer Size = %d \n\n",size);
- }
-
- /* Write several times to ringbuffer */
- for (index=0; index<6; index++)
- {
- memset(buf,0,1024);
-
- sprintf(buf,"%d",index);
- dlt_ringbuffer_put(&mybuf,buf,strlen(buf));
-
- if (vflag)
- {
- printf("W[%d], Bytes = %d, Hex: ", index, strlen(buf));
- dlt_print_hex((uint8_t *)buf, strlen(buf));
- printf("\n");
- }
- }
-
- if (vflag)
- {
- printf("\nCount=%d, Max. by buffer size %d = %d\n",mybuf.count, size, (int)(size/(strlen(buf)+sizeof(unsigned int))));
- }
-
- /* Check value of mybuf.count, counting the elements in ringbuffer */
- if (mybuf.count!=(int)(size/(strlen(buf)+sizeof(unsigned int))))
- {
- tests_failed++;
- printf("Test1i FAILED\n");
-
- break;
- }
-
- result_index = 0;
-
- /* Read several times from ringbuffer */
- for (index=0; index<6; index++)
- {
- memset(buf,0,1024);
-
- if (dlt_ringbuffer_get(&mybuf,buf,&c)!=-1)
- {
- if (vflag)
- {
- printf("R[%d], Bytes = %d, Hex: ", index, c);
- dlt_print_hex((uint8_t *)buf, c);
- printf("\n");
- }
-
- if (c==1)
- {
- result[result_index] = buf[0];
- }
- result_index++;
- }
- }
-
- /* Check value of mybuf.count, counting the elements in ringbuffer, must be 0 now */
- if (mybuf.count!=0)
- {
- tests_failed++;
- printf("Test1i FAILED\n");
-
- dlt_ringbuffer_free(&mybuf);
- return;
- }
-
- /* Check the read elements */
- for (index=0; index<result_index; index++)
- {
- sprintf(buf,"%d",((6-result_index)+index));
- if (result[index]!=buf[0])
- {
- tests_failed++;
- printf("Test1i FAILED\n");
-
- dlt_ringbuffer_free(&mybuf);
- return;
- }
- }
-
- if (vflag)
- {
- printf("\n");
- }
-
- dlt_ringbuffer_free(&mybuf);
- }
-
- tests_passed++;
- printf("Test1i PASSED\n");
-}
-
diff --git a/src/tests/dlt-test-stress.c b/src/tests/dlt-test-stress.c
index ea17857..07b3ae9 100755
--- a/src/tests/dlt-test-stress.c
+++ b/src/tests/dlt-test-stress.c
@@ -98,7 +98,7 @@ typedef struct
} thread_data_t;
#define STRESS1_NUM_CONTEXTS 3000
-#define STRESS2_MAX_NUM_THREADS 256
+#define STRESS2_MAX_NUM_THREADS 64
#define STRESS3_MAX_NUM_MESSAGES 512
#define MAX_TESTS 3
@@ -319,10 +319,7 @@ void stress2(void)
for (index=0;index<STRESS2_MAX_NUM_THREADS;index++)
{
- if (thread[index]!=0)
- {
- pthread_join(thread[index], NULL);
- }
+ pthread_join(thread[index], NULL);
}
printf("Finished stress test2 \n\n");
@@ -366,7 +363,7 @@ void stress3(void)
{
buffer[num] = num;
DLT_LOG(context_stress3,DLT_LOG_INFO,DLT_INT(num),DLT_RAW(buffer,num));
- usleep(1);
+ usleep(10000);
}
printf("Finished stress test3 \n\n");