Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2382/?format=api
https://patches.dpdk.org/api/patches/2382/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421671390-8560-2-git-send-email-tomaszx.kulasek@intel.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1421671390-8560-2-git-send-email-tomaszx.kulasek@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1421671390-8560-2-git-send-email-tomaszx.kulasek@intel.com", "date": "2015-01-19T12:43:09", "name": "[dpdk-dev,v2,1/2] Unit tests - test.h rework", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "6a1edd18ac4762f63bb691c5b31302db1c7840d3", "submitter": { "id": 155, "url": "https://patches.dpdk.org/api/people/155/?format=api", "name": "Tomasz Kulasek", "email": "tomaszx.kulasek@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1421671390-8560-2-git-send-email-tomaszx.kulasek@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/2382/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/2382/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 0ED0B5A82;\n\tMon, 19 Jan 2015 13:44:58 +0100 (CET)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id F06575A80\n\tfor <dev@dpdk.org>; Mon, 19 Jan 2015 13:44:54 +0100 (CET)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga101.jf.intel.com with ESMTP; 19 Jan 2015 04:44:53 -0800", "from unknown (HELO Sent) ([10.217.248.44])\n\tby orsmga001.jf.intel.com with SMTP; 19 Jan 2015 04:44:51 -0800", "by Sent (sSMTP sendmail emulation); Mon, 19 Jan 2015 13:44:29 +0200" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.09,426,1418112000\"; d=\"scan'208\";a=\"639303901\"", "From": "Tomasz Kulasek <tomaszx.kulasek@intel.com>", "To": "dev@dpdk.org", "Date": "Mon, 19 Jan 2015 13:43:09 +0100", "Message-Id": "<1421671390-8560-2-git-send-email-tomaszx.kulasek@intel.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1421671390-8560-1-git-send-email-tomaszx.kulasek@intel.com>", "References": "<1418375682-4703-4-git-send-email-michalx.k.jastrzebski@intel.com>\n\t<1421671390-8560-1-git-send-email-tomaszx.kulasek@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 1/2] Unit tests - test.h rework", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>\nSigned-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>\n---\n app/test/test.h | 112 ++++++++++++++++++++++++++++++++-----------------------\n 1 file changed, 66 insertions(+), 46 deletions(-)", "diff": "diff --git a/app/test/test.h b/app/test/test.h\nindex 896f7db..5450986 100644\n--- a/app/test/test.h\n+++ b/app/test/test.h\n@@ -36,62 +36,79 @@\n \n #include <sys/queue.h>\n \n-#define TEST_ASSERT(cond, msg, ...) do {\t\t\t\t\t\t\\\n-\t\tif (!(cond)) {\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\t\tprintf(\"TestCase %s() line %d failed: \"\t\t\t\\\n-\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__);\t\\\n-\t\t\treturn -1;\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n-} while (0)\n+#define TEST_SUCCESS (0)\n+#define TEST_FAILED (-1)\n+\n+/* Before including test.h file you can define\n+ * TEST_TRACE_FAILURE(_file, _line, _func) macro to better trace/debug test\n+ * failures. Mostly useful in test development phase. */\n+#ifndef TEST_TRACE_FAILURE\n+# define TEST_TRACE_FAILURE(_file, _line, _func)\n+#endif\n \n-#define TEST_ASSERT_EQUAL(a, b, msg, ...) do {\t\t\t\t\t\\\n-\t\tif (!(a == b)) {\t\t\t\t\t\t\t\t\t\t\\\n-\t\t\tprintf(\"TestCase %s() line %d failed: \"\t\t\t\t\\\n-\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__);\t\\\n-\t\t\treturn -1;\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n+#define TEST_ASSERT(cond, msg, ...) do { \\\n+\t\tif (!(cond)) { \\\n+\t\t\tprintf(\"TestCase %s() line %d failed: \" \\\n+\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__); \\\n+\t\t\tTEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \\\n+\t\t\treturn TEST_FAILED; \\\n+\t\t} \\\n } while (0)\n \n-#define TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do {\t\t\t\t\\\n-\t\tif (!(a != b)) {\t\t\t\t\t\t\t\t\t\t\\\n-\t\t\tprintf(\"TestCase %s() line %d failed: \"\t\t\t\\\n-\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__);\t\\\n-\t\t\treturn -1;\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n+#define TEST_ASSERT_EQUAL(a, b, msg, ...) do { \\\n+\t\tif (!(a == b)) { \\\n+\t\t\tprintf(\"TestCase %s() line %d failed: \" \\\n+\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__); \\\n+\t\t\tTEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \\\n+\t\t\treturn TEST_FAILED; \\\n+\t\t} \\\n } while (0)\n \n-#define TEST_ASSERT_SUCCESS(val, msg, ...) do {\t\t\t\t\t\\\n-\t\tif (!(val == 0)) {\t\t\t\t\t\t\t\t\t\t\\\n-\t\t\tprintf(\"TestCase %s() line %d failed (err %d): \"\t\\\n-\t\t\t\tmsg \"\\n\", __func__, __LINE__, val,\t\t\t\t\\\n-\t\t\t\t##__VA_ARGS__);\t\t\t\t\t\t\t\t\t\\\n-\t\t\treturn -1;\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n+#define TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do { \\\n+\t\tif (!(a != b)) { \\\n+\t\t\tprintf(\"TestCase %s() line %d failed: \" \\\n+\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__); \\\n+\t\t\tTEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \\\n+\t\t\treturn TEST_FAILED; \\\n+\t\t} \\\n } while (0)\n \n-#define TEST_ASSERT_FAIL(val, msg, ...) do {\t\t\t\t\t\\\n-\t\tif (!(val != 0)) {\t\t\t\t\t\t\t\t\t\t\\\n-\t\t\tprintf(\"TestCase %s() line %d failed: \"\t\t\t\\\n-\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__);\t\\\n-\t\t\treturn -1;\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n+#define TEST_ASSERT_SUCCESS(val, msg, ...) do { \\\n+\t\ttypeof(val) _val = (val); \\\n+\t\tif (!(_val == 0)) { \\\n+\t\t\tprintf(\"TestCase %s() line %d failed (err %d): \" \\\n+\t\t\t\tmsg \"\\n\", __func__, __LINE__, _val, \\\n+\t\t\t\t##__VA_ARGS__); \\\n+\t\t\tTEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \\\n+\t\t\treturn TEST_FAILED; \\\n+\t\t} \\\n } while (0)\n \n+#define TEST_ASSERT_FAIL(val, msg, ...) do { \\\n+\t\tif (!(val != 0)) { \\\n+\t\t\tprintf(\"TestCase %s() line %d failed: \" \\\n+\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__); \\\n+\t\t\tTEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \\\n+\t\t\treturn TEST_FAILED; \\\n+\t\t} \\\n+} while (0)\n \n-#define TEST_ASSERT_NULL(val, msg, ...) do {\t\t\t\t\t\\\n-\t\tif (!(val == NULL)) {\t\t\t\t\t\t\t\t\t\\\n-\t\t\tprintf(\"TestCase %s() line %d failed: \"\t\t\t\\\n-\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__);\t\\\n-\t\t\treturn -1;\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n+#define TEST_ASSERT_NULL(val, msg, ...) do { \\\n+\t\tif (!(val == NULL)) { \\\n+\t\t\tprintf(\"TestCase %s() line %d failed: \" \\\n+\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__); \\\n+\t\t\tTEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \\\n+\t\t\treturn TEST_FAILED; \\\n+\t\t} \\\n } while (0)\n \n-#define TEST_ASSERT_NOT_NULL(val, msg, ...) do {\t\t\t\t\\\n-\t\tif (!(val != NULL)) {\t\t\t\t\t\t\t\t\t\\\n-\t\t\tprintf(\"TestCase %s() line %d failed: \"\t\t\t\\\n-\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__);\t\\\n-\t\t\treturn -1;\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n+#define TEST_ASSERT_NOT_NULL(val, msg, ...) do { \\\n+\t\tif (!(val != NULL)) { \\\n+\t\t\tprintf(\"TestCase %s() line %d failed: \" \\\n+\t\t\t\tmsg \"\\n\", __func__, __LINE__, ##__VA_ARGS__); \\\n+\t\t\tTEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \\\n+\t\t\treturn TEST_FAILED; \\\n+\t\t} \\\n } while (0)\n \n struct unit_test_case {\n@@ -104,8 +121,11 @@ struct unit_test_case {\n \n #define TEST_CASE(fn) { NULL, NULL, fn, #fn \" succeeded\", #fn \" failed\"}\n \n-#define TEST_CASE_ST(setup, teardown, testcase) \t\t\\\n-\t\t{ setup, teardown, testcase, #testcase \" succeeded\",\t\\\n+#define TEST_CASE_NAMED(name, fn) { NULL, NULL, fn, name \" succeeded\", \\\n+\t\tname \" failed\"}\n+\n+#define TEST_CASE_ST(setup, teardown, testcase) \\\n+\t\t{ setup, teardown, testcase, #testcase \" succeeded\", \\\n \t\t#testcase \" failed \"}\n \n #define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL }\n", "prefixes": [ "dpdk-dev", "v2", "1/2" ] }{ "id": 2382, "url": "