[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r302167 - in /team/dvossel/f...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 18 10:00:58 CST 2011


Author: dvossel
Date: Tue Jan 18 10:00:53 2011
New Revision: 302167

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=302167
Log:
Addition of a format and format capabilities performance test.

Modified:
    team/dvossel/fixtheworld_phase1_step3/main/format.c
    team/dvossel/fixtheworld_phase1_step3/tests/test_format_api.c

Modified: team/dvossel/fixtheworld_phase1_step3/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/format.c?view=diff&rev=302167&r1=302166&r2=302167
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/format.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/format.c Tue Jan 18 10:00:53 2011
@@ -80,7 +80,6 @@
 {
 	format->fattr.rtp_marker_bit = 1;
 }
-
 
 int ast_format_get_video_mark(const struct ast_format *format)
 {

Modified: team/dvossel/fixtheworld_phase1_step3/tests/test_format_api.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/tests/test_format_api.c?view=diff&rev=302167&r1=302166&r2=302167
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/tests/test_format_api.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/tests/test_format_api.c Tue Jan 18 10:00:53 2011
@@ -673,12 +673,66 @@
 	ast_test_status_update(test, "%d items iterated over\n", num);
 	return (num == 6) ? AST_TEST_PASS : AST_TEST_FAIL;
 }
+
+/*!
+ * \internal
+ */
+AST_TEST_DEFINE(format_test5)
+{
+	int x;
+	int res = AST_TEST_PASS;
+	struct ast_format_cap *cap1;
+	struct ast_format_cap *cap2;
+	struct ast_format_cap *joint;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "ast_format_test5";
+		info->category = "/main/format/";
+		info->summary = "Load Test ast_format_cap";
+		info->description =
+			"This test exercises the Ast Capability API and its iterators for the purpose "
+			"of measuring performance.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	for (x = 0; x < 2000; x++) {
+		cap1 = ast_format_cap_alloc();
+		cap2 = ast_format_cap_alloc();
+		joint = ast_format_cap_alloc();
+		if (!cap1 || !cap2 || !joint) {
+			ast_test_status_update(test, "cap alloc fail\n");
+			return AST_TEST_FAIL;
+		}
+		ast_format_cap_add_all(cap1);
+		ast_format_cap_add_all_by_type(cap2, AST_FORMAT_TYPE_AUDIO);
+		ast_format_cap_joint_copy(cap1, cap2, joint);
+		if (!(ast_format_cap_identical(cap2, joint))) {
+			ast_test_status_update(test, "failed identical test\n");
+			res = AST_TEST_FAIL;
+			cap1 = ast_format_cap_destroy(cap1);
+			cap2 = ast_format_cap_destroy(cap2);
+			joint = ast_format_cap_destroy(joint);
+			break;
+		}
+		cap1 = ast_format_cap_destroy(cap1);
+		cap2 = ast_format_cap_destroy(cap2);
+		joint = ast_format_cap_destroy(joint);
+	}
+
+	return res;
+}
+
+
 static int unload_module(void)
 {
 	AST_TEST_UNREGISTER(format_test1);
 	AST_TEST_UNREGISTER(format_test2);
 	AST_TEST_UNREGISTER(format_test3);
 	AST_TEST_UNREGISTER(format_test4);
+	AST_TEST_UNREGISTER(format_test5);
 
 	return 0;
 }
@@ -689,6 +743,7 @@
 	AST_TEST_REGISTER(format_test2);
 	AST_TEST_REGISTER(format_test3);
 	AST_TEST_REGISTER(format_test4);
+	AST_TEST_REGISTER(format_test5);
 
 	return AST_MODULE_LOAD_SUCCESS;
 }




More information about the asterisk-commits mailing list