diff options
author | Bui Nguyen Quoc Thanh <Thanh.BuiNguyenQuoc@vn.bosch.com> | 2019-06-06 11:33:03 +0700 |
---|---|---|
committer | Saya Sugiura <ssugiura@jp.adit-jv.com> | 2019-06-18 17:22:09 +0900 |
commit | e1967c7ba42c08de1925e958b3dfa0b5c430dbfd (patch) | |
tree | 49a5646bc6f37f5ec57a366c975fd1fc86d27b9c /src/tests | |
parent | a2c4a10eefbb34113cc5c10dee931f95a3d0764d (diff) | |
download | DLT-daemon-e1967c7ba42c08de1925e958b3dfa0b5c430dbfd.tar.gz |
dlt-test: Add options
Support two options for dlt-test-filestransfer to specify the absolute
path to tested files.
Signed-off-by: Bui Nguyen Quoc Thanh <Thanh.BuiNguyenQuoc@vn.bosch.com>
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/dlt-test-filetransfer.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/src/tests/dlt-test-filetransfer.c b/src/tests/dlt-test-filetransfer.c index 05a54d9..ec157f2 100644 --- a/src/tests/dlt-test-filetransfer.c +++ b/src/tests/dlt-test-filetransfer.c @@ -27,7 +27,7 @@ /******************************************************************************* ** ** -** SRC-MODULE: dlt-test-client.c ** +** SRC-MODULE: dlt-test-filetransfer.c ** ** ** ** TARGET : linux ** ** ** @@ -375,9 +375,25 @@ int testFile3Run3() return 0; } +void usage() +{ + char version[255]; + + dlt_get_version(version, 255); + + printf("Usage: dlt-test-filestransfer [options]\n"); + printf("Test filestransfer application by transfering files.\n"); + printf("%s \n", version); + printf("Options:\n"); + printf(" -h display help information\n"); + printf(" -t <path> absolute path to a text file\n"); + printf(" -i <path> absolute path to an image file\n"); +} + /*!Main program dlt-test-filestransfer starts here */ -int main(void) +int main(int argc, char* argv[]) { + int c; /*First file contains some text */ file1 = "/usr/local/share/dlt-filetransfer/dlt-test-filetransfer-file"; /*Second file is a picture */ @@ -389,6 +405,33 @@ int main(void) /*Third file doesn't exist. Just to test the reaction when the file isn't available. */ file3_3 = "dlt-test-filetransfer-doesntExist_3"; + while((c = getopt(argc, argv, "ht:i:")) != -1) + { + switch (c) + { + case 't': + { + file1 = optarg; + break; + } + case 'i': + { + file2 = optarg; + break; + } + case 'h': + { + usage(); + return 0; + } + default: + { + usage(); + return -1; + } + } + } + /*Register the application at the dlt-daemon */ DLT_REGISTER_APP("FLTR", "Test Application filetransfer"); |