lists.linaro.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
List overview
Download
Acc
March 2024
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
acc@lists.linaro.org
2 participants
5 discussions
Start a n
N
ew thread
[PATCH 0/4] uadk_engine: some cleanup
by Zhiqi Song
This series of patches are mainly used for cleanup. Zhiqi Song (4): uadk_engine: cleanup code style of async functions cipher: cleanup repeated function invoking digest: add ctx allocation check sm2: add ctx allocation check src/uadk_async.c | 126 ++++++++++++++++++++++------------------------ src/uadk_async.h | 3 ++ src/uadk_cipher.c | 7 ++- src/uadk_digest.c | 2 + src/uadk_sm2.c | 6 ++- 5 files changed, 74 insertions(+), 70 deletions(-) -- 2.33.0
8 months, 3 weeks
1
4
0
0
[PATCH 1/2] uadk/digest: modify spelling errors
by Zhiqi Song
Modify spelling errors related to digest stream mode. Signed-off-by: Zhiqi Song <songzhiqi1(a)huawei.com> --- drv/hash_mb/hash_mb.c | 4 ++-- drv/hisi_sec.c | 8 ++++---- drv/isa_ce_sm3.c | 4 ++-- include/drv/wd_digest_drv.h | 6 +++--- v1/test/hisi_sec_test/test_hisi_sec.c | 4 ++-- v1/test/hisi_sec_test_sgl/test_hisi_sec_sgl.c | 4 ++-- wd_digest.c | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drv/hash_mb/hash_mb.c b/drv/hash_mb/hash_mb.c index 0f27c11..4750062 100644 --- a/drv/hash_mb/hash_mb.c +++ b/drv/hash_mb/hash_mb.c @@ -406,7 +406,7 @@ static int hash_do_partial(struct hash_mb_poll_queue *poll_queue, int ret = WD_SUCCESS; switch (bd_type) { - case HASH_FRIST_BLOCK: + case HASH_FIRST_BLOCK: ret = hash_first_block_process(d_msg, job, poll_queue->ops->iv_bytes); break; case HASH_MIDDLE_BLOCK: @@ -434,7 +434,7 @@ static void hash_mb_init_iv(struct hash_mb_poll_queue *poll_queue, job->opad.opad_size = 0; switch (bd_type) { - case HASH_FRIST_BLOCK: + case HASH_FIRST_BLOCK: memcpy(job->result_digest, poll_queue->ops->iv_data, poll_queue->ops->iv_bytes); if (d_msg->mode != WD_DIGEST_HMAC) return; diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c index 2eaac51..e66fb00 100644 --- a/drv/hisi_sec.c +++ b/drv/hisi_sec.c @@ -1536,7 +1536,7 @@ static int fill_digest_long_hash(handle_t h_qp, struct wd_digest_msg *msg, if (ret) return ret; - if (block_type == HASH_FRIST_BLOCK) { + if (block_type == HASH_FIRST_BLOCK) { /* Long hash first */ sqe->ai_apd_cs = AI_GEN_INNER; sqe->ai_apd_cs |= AUTHPAD_NOPAD << AUTHPAD_OFFSET; @@ -1618,7 +1618,7 @@ static int digest_bd2_type_check(struct wd_digest_msg *msg) enum hash_block_type type = get_hash_block_type(msg); /* Long hash first and middle bd */ - if (type == HASH_FRIST_BLOCK || type == HASH_MIDDLE_BLOCK) { + if (type == HASH_FIRST_BLOCK || type == HASH_MIDDLE_BLOCK) { WD_ERR("hardware v2 not supports 0 size in long hash!\n"); return -WD_EINVAL; } @@ -1636,7 +1636,7 @@ static int digest_bd3_type_check(struct wd_digest_msg *msg) { enum hash_block_type type = get_hash_block_type(msg); /* Long hash first and middle bd */ - if (type == HASH_FRIST_BLOCK || type == HASH_MIDDLE_BLOCK) { + if (type == HASH_FIRST_BLOCK || type == HASH_MIDDLE_BLOCK) { WD_ERR("invalid: hardware v3 not supports 0 size in long hash!\n"); return -WD_EINVAL; } @@ -1889,7 +1889,7 @@ static int fill_digest_long_hash3(handle_t h_qp, struct wd_digest_msg *msg, if (ret) return ret; - if (block_type == HASH_FRIST_BLOCK) { + if (block_type == HASH_FIRST_BLOCK) { /* Long hash first */ sqe->auth_mac_key |= AI_GEN_INNER << SEC_AI_GEN_OFFSET_V3; sqe->stream_scene.stream_auth_pad = AUTHPAD_NOPAD; diff --git a/drv/isa_ce_sm3.c b/drv/isa_ce_sm3.c index 2789a08..5fc7acc 100644 --- a/drv/isa_ce_sm3.c +++ b/drv/isa_ce_sm3.c @@ -188,7 +188,7 @@ static int do_sm3_ce(struct wd_digest_msg *msg, __u8 *out_digest) sm3_ce_update(&sctx, data, data_len, sm3_ce_block_compress); sm3_ce_final(&sctx, out_digest, sm3_ce_block_compress); break; - case HASH_FRIST_BLOCK: + case HASH_FIRST_BLOCK: sm3_ce_init(&sctx); sm3_ce_update(&sctx, data, data_len, sm3_ce_block_compress); trans_output_result(out_digest, sctx.word_reg); @@ -306,7 +306,7 @@ static int do_hmac_sm3_ce(struct wd_digest_msg *msg, __u8 *out_hmac) sm3_ce_hmac_update(&hctx, data, data_len); sm3_ce_hmac_final(&hctx, out_hmac); break; - case HASH_FRIST_BLOCK: + case HASH_FIRST_BLOCK: sm3_ce_hmac_init(&hctx, key, key_len); sm3_ce_hmac_update(&hctx, data, data_len); trans_output_result(out_hmac, hctx.sctx.word_reg); diff --git a/include/drv/wd_digest_drv.h b/include/drv/wd_digest_drv.h index 7d86b65..5e3e821 100644 --- a/include/drv/wd_digest_drv.h +++ b/include/drv/wd_digest_drv.h @@ -12,7 +12,7 @@ extern "C" { #endif enum hash_block_type { - HASH_FRIST_BLOCK, + HASH_FIRST_BLOCK, HASH_MIDDLE_BLOCK, HASH_END_BLOCK, HASH_SINGLE_BLOCK, @@ -66,13 +66,13 @@ static inline enum hash_block_type get_hash_block_type(struct wd_digest_msg *msg { /* * [has_next , iv_bytes] - * [ 1 , 0 ] = long hash(frist bd) + * [ 1 , 0 ] = long hash(first bd) * [ 1 , 1 ] = long hash(middle bd) * [ 0 , 1 ] = long hash(end bd) * [ 0 , 0 ] = block hash(single bd) */ if (msg->has_next && !msg->iv_bytes) - return HASH_FRIST_BLOCK; + return HASH_FIRST_BLOCK; else if (msg->has_next && msg->iv_bytes) return HASH_MIDDLE_BLOCK; else if (!msg->has_next && msg->iv_bytes) diff --git a/v1/test/hisi_sec_test/test_hisi_sec.c b/v1/test/hisi_sec_test/test_hisi_sec.c index be4ee9d..05c91ad 100644 --- a/v1/test/hisi_sec_test/test_hisi_sec.c +++ b/v1/test/hisi_sec_test/test_hisi_sec.c @@ -1463,7 +1463,7 @@ static int sec_cipher_async_test(int thread_num, __u64 lcore_mask, SEC_TST_PRT("%s(): create pool fail!\n", __func__); return -ENOMEM; } - /* frist create the async poll thread! */ + /* first create the async poll thread! */ test_thrds_data[0].pool = pool; test_thrds_data[0].q = &q; test_thrds_data[0].thread_num = 1; @@ -2070,7 +2070,7 @@ static int sec_aead_async_test(int thd_num, __u64 lcore_mask, SEC_TST_PRT("%s(): create pool fail!\n", __func__); return -ENOMEM; } - /* frist create the async poll thread! */ + /* first create the async poll thread! */ test_thrds_data[0].pool = pool; test_thrds_data[0].q = &q; test_thrds_data[0].thread_num = 1; diff --git a/v1/test/hisi_sec_test_sgl/test_hisi_sec_sgl.c b/v1/test/hisi_sec_test_sgl/test_hisi_sec_sgl.c index b7513d1..ba5cdfa 100644 --- a/v1/test/hisi_sec_test_sgl/test_hisi_sec_sgl.c +++ b/v1/test/hisi_sec_test_sgl/test_hisi_sec_sgl.c @@ -1733,7 +1733,7 @@ static int sec_cipher_async_test(int thread_num, __u64 lcore_mask, SEC_TST_PRT("%s(): create pool fail!\n", __func__); return -ENOMEM; } - /* frist create the async poll thread! */ + /* first create the async poll thread! */ test_thrds_data[0].pool = pool; test_thrds_data[0].q = &q; test_thrds_data[0].thread_num = 1; @@ -2640,7 +2640,7 @@ static int sec_aead_async_test(int thd_num, __u64 lcore_mask, return -ENOMEM; } - /* frist create the async poll thread! */ + /* first create the async poll thread! */ test_thrds_data[0].pool = pool; test_thrds_data[0].q = &q; test_thrds_data[0].thread_num = 1; diff --git a/wd_digest.c b/wd_digest.c index dfe709b..4832de8 100644 --- a/wd_digest.c +++ b/wd_digest.c @@ -55,7 +55,7 @@ struct wd_digest_stream_data { /* Total data length for stream mode */ __u64 long_data_len; /* - * Notify the stream message state, zero is frist message, + * Notify the stream message state, zero is first message, * non-zero is middle or final message. */ int msg_state; -- 2.30.0
9 months, 1 week
1
0
0
0
[PATCH 0/4] Support sm3 ce instruction
by Zhiqi Song
1. Support sync sm3 ce instruction. 2. Some cleanup and bugfix. Zhiqi Song (4): uadk: remove redundant header file in makefile uadk/isa-ce: support sm3 ce instruction uadk: fix control range of environmemt variable uadk/util: use default sched_type for instruction task Makefile.am | 20 +- configure.ac | 3 + drv/isa_ce_sm3.c | 401 ++++++++++++++++++++ drv/isa_ce_sm3.h | 86 +++++ drv/isa_ce_sm3_armv8.S | 765 ++++++++++++++++++++++++++++++++++++++ include/drv/arm_arch_ce.h | 199 ++++++++++ include/wd_alg.h | 43 +++ include/wd_sched.h | 2 +- wd_alg.c | 32 +- wd_digest.c | 2 +- wd_sched.c | 2 +- wd_util.c | 92 ++++- 12 files changed, 1619 insertions(+), 28 deletions(-) create mode 100644 drv/isa_ce_sm3.c create mode 100644 drv/isa_ce_sm3.h create mode 100644 drv/isa_ce_sm3_armv8.S create mode 100644 include/drv/arm_arch_ce.h -- 2.33.0
9 months, 2 weeks
1
4
0
0
[PATCH 0/4] Support sm3 ce instruction
by Zhiqi Song
1. Support sync sm3 ce instruction. 2. Some cleanup and bugfix. Zhiqi Song (4): uadk: remove redundant header file in makefile uadk/isa-ce: support sm3 ce instruction uadk: fix control range of environmemt variable uadk/util: use default sched_type for instruction task Makefile.am | 20 +- configure.ac | 3 + drv/isa_ce_sm3.c | 401 ++++++++++++++++++++ drv/isa_ce_sm3.h | 86 +++++ drv/isa_ce_sm3_armv8.S | 765 ++++++++++++++++++++++++++++++++++++++ include/drv/arm_arch_ce.h | 199 ++++++++++ include/wd_alg.h | 43 +++ include/wd_sched.h | 2 +- wd_alg.c | 32 +- wd_digest.c | 2 +- wd_sched.c | 2 +- wd_util.c | 92 ++++- 12 files changed, 1619 insertions(+), 28 deletions(-) create mode 100644 drv/isa_ce_sm3.c create mode 100644 drv/isa_ce_sm3.h create mode 100644 drv/isa_ce_sm3_armv8.S create mode 100644 include/drv/arm_arch_ce.h -- 2.33.0
9 months, 2 weeks
1
4
0
0
[PATCH] uadk: sample - add test case for compression
by Yang Shen
1. Support test fork. 2. Support test wd_comp_init2. 3. Support test zlibwrapper. Signed-off-by: Yang Shen <shenyang39(a)huawei.com> --- sample/uadk_comp.c | 364 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 353 insertions(+), 11 deletions(-) diff --git a/sample/uadk_comp.c b/sample/uadk_comp.c index 908c7bcb..1d259f0b 100644 --- a/sample/uadk_comp.c +++ b/sample/uadk_comp.c @@ -7,6 +7,7 @@ #include "wd_alg_common.h" #include "wd_comp.h" #include "wd_sched.h" +#include "wd_zlibwrapper.h" #define SCHED_RR_NAME "sched_rr" @@ -19,6 +20,8 @@ #define required_argument 1 #define optional_argument 2 +#define MAX_THREAD 1024 + struct request_config { char algname[MAX_ALG_LEN]; enum wd_comp_alg_type alg; @@ -42,6 +45,11 @@ struct acc_alg_item { int alg; }; +struct comp_sample_data { + int size; + char data[128]; +}; + static struct request_config config = { .complv = WD_COMP_L8, .optype = WD_DIR_COMPRESS, @@ -52,6 +60,8 @@ static struct request_config config = { static struct request_data data; +static pthread_t threads[MAX_THREAD]; + static struct acc_alg_item alg_options[] = { {"zlib", WD_ZLIB}, {"gzip", WD_GZIP}, @@ -60,6 +70,11 @@ static struct acc_alg_item alg_options[] = { {"", WD_COMP_ALG_MAX} }; +static struct comp_sample_data sample_data = { + .size = 20, + .data = "Welcome to use uadk!", +}; + static void cowfail(char *s) { fprintf(stderr, "" @@ -74,6 +89,313 @@ static void cowfail(char *s) "\n", s); } +static void *initthread(void *data) +{ + int ret; + + ret = wd_comp_init2("zlib", 0, TASK_HW); + if (ret) + fprintf(stderr, "%s: something is wrong, ret = %d!", __func__, ret); + + return NULL; +} + +static int test_fork(void) +{ + int ret; + + pthread_create(&threads[0], NULL, initthread, NULL); + + sleep(2); + ret = fork(); + if (ret == 0) + ret = wd_comp_init2("zlib", 0, TASK_HW); + else + ret = pthread_join(threads[0], NULL); + + wd_comp_uninit2(); + + return ret; +} + +static int test_uadk_init2(void) +{ + struct wd_comp_sess_setup setup[2] = {0}; + struct sched_params param[2] = {0}; + struct wd_comp_req req[2] = {0}; + handle_t h_sess[2]; + void *src, *dst; + int ret; + + ret = wd_comp_init2("zlib", 0, TASK_HW); + if (ret) + return ret; + + setup[0].alg_type = WD_ZLIB; + setup[0].op_type = WD_DIR_COMPRESS; + setup[0].comp_lv = 1; + setup[0].win_sz = 1; + param[0].type = WD_DIR_COMPRESS; + setup[0].sched_param = ¶m[0]; + + h_sess[0] = wd_comp_alloc_sess(&setup[0]); + if (!h_sess[0]) { + fprintf(stderr, "%s fail to alloc comp sess.\n", __func__); + ret = -WD_EINVAL; + goto out_uninit; + } + + setup[1].alg_type = WD_ZLIB; + setup[1].op_type = WD_DIR_DECOMPRESS; + setup[1].comp_lv = 1; + setup[1].win_sz = 1; + param[1].type = WD_DIR_DECOMPRESS; + setup[1].sched_param = ¶m[1]; + h_sess[1] = wd_comp_alloc_sess(&setup[1]); + if (!h_sess[1]) { + fprintf(stderr, "%s fail to alloc decomp sess.\n", __func__); + ret = -WD_EINVAL; + goto out_free_comp_sess; + } + + src = calloc(1, sizeof(char) * 128); + if (!src) { + ret = -WD_ENOMEM; + goto out_free_decomp_sess; + } + + dst = calloc(1, sizeof(char) * 128); + if (!dst) { + ret = -WD_ENOMEM; + goto out_free_src; + } + + req[0].src = sample_data.data; + req[0].src_len = sample_data.size; + req[0].op_type = WD_DIR_COMPRESS; + req[0].dst = dst; + req[0].dst_len = 128; + + ret = wd_do_comp_sync(h_sess[0], &req[0]); + if (ret) + goto out_free_dst; + + req[1].src = dst; + req[1].src_len = req[0].dst_len; + req[1].op_type = WD_DIR_DECOMPRESS; + req[1].dst = src; + req[1].dst_len = 128; + + ret = wd_do_comp_sync(h_sess[1], &req[1]); + + ret = strcmp(sample_data.data, src); + if (ret) + fprintf(stderr, "decompress fail\n"); + else + fprintf(stderr, "good\n"); + +out_free_dst: + free(dst); +out_free_src: + free(src); +out_free_decomp_sess: + wd_comp_free_sess(h_sess[1]); +out_free_comp_sess: + wd_comp_free_sess(h_sess[0]); +out_uninit: + wd_comp_uninit2(); + return ret; +} + +static int test_uadk_zlib_deflate(void *src, int src_len, void *dest, int dst_len) +{ + __u32 chunk = 128 * 1024; + z_stream zstrm = {0}; + int ret, flush, have; + + ret = wd_comp_init2("zlib", 0, TASK_HW); + if (ret) { + fprintf(stderr, "%s fail to init wd_comp.\n", __func__); + return ret; + } + + ret = wd_deflate_init(&zstrm, 0, 15); + if (ret) { + fprintf(stderr, "%s fail to init deflate.\n", __func__); + return ret; + } + + zstrm.next_in = src; + do { + if (src_len > chunk) { + zstrm.avail_in = chunk; + src_len -= chunk; + } else { + zstrm.avail_in = src_len; + src_len = 0; + } + + flush = src_len ? Z_SYNC_FLUSH : Z_FINISH; + + /* + * Run wd_deflate() on input until output buffer not full, + * finish compression if all of source has been read in. + */ + do { + zstrm.avail_out = chunk; + zstrm.next_out = dest; + ret = wd_deflate(&zstrm, flush); + have = chunk - zstrm.avail_out; + dest += have; + } while (zstrm.avail_in > 0); + + /* done when last data in file processed */ + } while (flush != Z_FINISH); + + ret = ret == Z_STREAM_END ? zstrm.total_out : ret; + + (void)wd_deflate_end(&zstrm); + + return ret; +} + +static int test_uadk_zlib_inflate(void *src, int src_len, void *dest, int dst_len) +{ + __u32 chunk = 128 * 1024; + // __u32 chunk = 1024 * 1024 * 2; + z_stream zstrm = {0}; + int ret, have; + + ret = wd_inflate_init(&zstrm, 15); + if (ret) { + fprintf(stderr, "%s fail to init inflate.\n", __func__); + return ret; + } + + zstrm.next_in = src; + do { + if (src_len > chunk) { + zstrm.avail_in = chunk; + src_len -= chunk; + } else { + zstrm.avail_in = src_len; + src_len = 0; + } + /* + * Run wd_deflate() on input until output buffer not full, + * finish compression if all of source has been read in. + */ + do { + zstrm.avail_out = chunk; + zstrm.next_out = dest; + ret = wd_inflate(&zstrm, Z_SYNC_FLUSH); + have = chunk - zstrm.avail_out; + dest += have; + } while (zstrm.avail_in > 0); + + /* done when last data in file processed */ + } while (ret != Z_STREAM_END); + + ret = ret == Z_STREAM_END ? zstrm.total_out : ret; + + (void)wd_inflate_end(&zstrm); + + return ret; +} + +static int test_uadk_zlib(void) +{ + void *src, *dst, *src2; + FILE *source = stdin; + FILE *dest = stdout; + int ret, fd, sz; + struct stat s; + + fd = fileno(source); + ret = fstat(fd, &s); + if (ret < 0) { + fprintf(stderr, "%s fstat error!\n", __func__); + return ret; + } + + src = calloc(1, sizeof(char) * s.st_size); + if (!src) { + fprintf(stderr, "%s calloc error!\n", __func__); + return -WD_ENOMEM; + } + + src2 = calloc(1, sizeof(char) * s.st_size * 2); + if (!src2) { + fprintf(stderr, "%s calloc2 error!\n", __func__); + ret = -WD_ENOMEM; + goto free_src; + } + + dst = calloc(1, sizeof(char) * s.st_size * 2); + if (!dst) { + fprintf(stderr, "%s calloc error!\n", __func__); + ret = -WD_ENOMEM; + goto free_src2; + } + + sz = fread(src, 1, s.st_size, source); + if (sz != s.st_size) { + fprintf(stderr, "%s read file sz != file.size!\n", __func__); + ret = -WD_EINVAL; + goto free_dst; + } + + ret = test_uadk_zlib_deflate(src, sz, dst, sz * 2); + if (ret < 0) { + fprintf(stderr, "%s do deflate fail ret %d\n", __func__, ret); + goto free_dst; + } + + ret = fwrite(dst, 1, ret, dest); + if (ret < 0) + fprintf(stderr, "%s file write fail ret %d\n", __func__, ret); + + ret = test_uadk_zlib_inflate(dst, ret, src2, sz * 2); + if (ret < 0) { + fprintf(stderr, "%s do inflate fail ret %d\n", __func__, ret); + goto free_dst; + } + + ret = memcmp(src, src2, sz); + if (!ret) + fprintf(stderr, "%s good!\n", __func__); + +free_dst: + free(dst); +free_src2: + free(src2); +free_src: + free(src); + return ret; +} + +static int test_func(int test_mode) +{ + int ret; + + switch (test_mode) { + case 0: + ret = test_fork(); + break; + case 1: + ret = test_uadk_init2(); + break; + case 2: + ret = test_uadk_zlib(); + break; + default: + ret = -WD_EINVAL; + break; + } + + return ret; +} + static struct uacce_dev_list* get_dev_list(char *alg_name) { struct uacce_dev_list *list, *p, *head = NULL, *prev = NULL; @@ -147,7 +469,7 @@ static struct wd_sched *uadk_comp_sched_init(void) sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 2, 2, lib_poll_func); if (!sched) { - printf("%s fail to alloc sched.\n", __func__); + fprintf(stderr, "%s fail to alloc sched.\n", __func__); return NULL; } sched->name = SCHED_RR_NAME; @@ -388,31 +710,31 @@ static int operation(FILE *source, FILE *dest) ret = uadk_comp_ctx_init(); if (ret) { - fprintf(stderr, "%s fail to init ctx!\n", __func__); + fprintf(stderr, "%s fail to init ctx! %d\n", __func__, ret); return ret; } ret = uadk_comp_sess_init(); if (ret) { - fprintf(stderr, "%s fail to init sess!\n", __func__); + fprintf(stderr, "%s fail to init sess! %d\n", __func__, ret); goto out_ctx_uninit; } ret = uadk_comp_request_init(source); if (ret) { - fprintf(stderr, "%s fail to init request!\n", __func__); + fprintf(stderr, "%s fail to init request! %d\n", __func__, ret); goto out_sess_uninit; } ret = uadk_do_comp(); if (ret) { - fprintf(stderr, "%s fail to do request!\n", __func__); + fprintf(stderr, "%s fail to do request! %d\n", __func__, ret); goto out_sess_uninit; } ret = uadk_comp_write_file(dest); if (ret) - fprintf(stderr, "%s fail to write result!\n", __func__); + fprintf(stderr, "%s fail to write result! %d\n", __func__, ret); uadk_comp_request_uninit(); @@ -445,9 +767,10 @@ static void print_help(void) int main(int argc, char *argv[]) { + int ret, c, test_mode; int option_index = 0; int help = 0; - int ret, c; + int test = 0; static struct option long_options[] = { {"help", no_argument, 0, 0}, @@ -455,6 +778,9 @@ int main(int argc, char *argv[]) {"complv", required_argument, 0, 2}, {"optype", required_argument, 0, 3}, {"winsize", required_argument, 0, 4}, + {"fork", no_argument, 0, 5}, + {"init2", no_argument, 0, 6}, + {"zlib", no_argument, 0, 7}, {0, 0, 0, 0} }; @@ -470,8 +796,8 @@ int main(int argc, char *argv[]) case 1: config.list = get_dev_list(optarg); if (!config.list) { - cowfail("Can't find your algorithm!\n"); help = 1; + cowfail("Can't find your algorithm!\n"); } else { strcpy(config.algname, optarg); } @@ -485,9 +811,21 @@ int main(int argc, char *argv[]) case 4: config.winsize = strtol(optarg, NULL, 0); break; + case 5: + test = 1; + test_mode = 0; + break; + case 6: + test = 1; + test_mode = 1; + break; + case 7: + test = 1; + test_mode = 2; + break; default: help = 1; - cowfail("bad input test parameter!\n"); + cowfail("Bad input test parameter!\n"); break; } } @@ -497,9 +835,13 @@ int main(int argc, char *argv[]) exit(-1); } - ret = operation(stdin, stdout); + if (test == 1) + ret = test_func(test_mode); + else + ret = operation(stdin, stdout); + if (ret) - cowfail("So sad for we do something wrong!\n"); + cowfail("So sad for someting wrong!\n"); return ret; } -- 2.33.0
9 months, 2 weeks
1
0
0
0
← Newer
1
Older →
Jump to page:
1
Results per page:
10
25
50
100
200