[svn-commits] mjordan: branch 13 r428892 - in /branches/13: ./ tests/test_cel.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Dec 3 13:49:19 CST 2014


Author: mjordan
Date: Wed Dec  3 13:49:17 2014
New Revision: 428892

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=428892
Log:
tests/test_cel: Fix CEL unit test failures caused by attended transfer changes

When the publication of attended transfer messages were pushed to another
thread, some subtle race conditions were introduced with the CEL unit tests.
This patch fixes one of them, and pushes the other to ASTERISK-22367, which
already exists to fix another bouncy CEL unit test.

In particular, this patch fixes the test_cel_attended_transfer_bridges_link
test, and defers the test_cel_attended_transfer_bridges_swap test to the
aforementioned JIRA issue.

ASTERISK-22367
........

Merged revisions 428891 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    branches/13/   (props changed)
    branches/13/tests/test_cel.c

Propchange: branches/13/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: branches/13/tests/test_cel.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/tests/test_cel.c?view=diff&rev=428892&r1=428891&r2=428892
==============================================================================
--- branches/13/tests/test_cel.c (original)
+++ branches/13/tests/test_cel.c Wed Dec  3 13:49:17 2014
@@ -1300,6 +1300,10 @@
 	return AST_TEST_PASS;
 }
 
+/* XXX Validation needs to take into account the BRIDGE_EXIT for Alice and the
+ * ATTENDEDTRANSFER message are not guaranteed to be ordered
+ */
+#ifdef RACEY_TESTS
 AST_TEST_DEFINE(test_cel_attended_transfer_bridges_swap)
 {
 	RAII_VAR(struct ast_channel *, chan_alice, NULL, safe_channel_release);
@@ -1362,8 +1366,8 @@
 	BRIDGE_ENTER_EVENT_PEER(chan_bob, bridge2, "CELTestChannel/David,CELTestChannel/Charlie");
 
 	BRIDGE_EXIT_EVENT(chan_david, bridge2);
+	BRIDGE_EXIT_EVENT(chan_alice, bridge1);
 	ATTENDEDTRANSFER_BRIDGE(chan_alice, bridge1, chan_david, bridge2, chan_charlie, chan_bob);
-	BRIDGE_EXIT_EVENT(chan_alice, bridge1);
 
 	do_sleep();
 	BRIDGE_EXIT(chan_bob, bridge2);
@@ -1379,6 +1383,7 @@
 
 	return AST_TEST_PASS;
 }
+#endif
 
 AST_TEST_DEFINE(test_cel_attended_transfer_bridges_merge)
 {
@@ -1524,23 +1529,10 @@
 	BRIDGE_ENTER(chan_david, bridge2);
 
 	/* Perform attended transfer */
-
-	/* The following events can not be matched directly since nothing is known
-	 * about the linking local channel.
-	 * ;1 and ;2 CHAN_START and ;2 ANSWER */
-	APPEND_DUMMY_EVENT();
-	APPEND_DUMMY_EVENT();
-	APPEND_DUMMY_EVENT();
-
 	ATTENDEDTRANSFER_BRIDGE(chan_alice, bridge1, chan_david, bridge2, chan_charlie, chan_bob);
 
 	ast_bridge_transfer_attended(chan_alice, chan_david);
 	do_sleep();
-
-	/* ;1 and ;2 BRIDGE_ENTER and ;1 ANSWER */
-	APPEND_DUMMY_EVENT();
-	APPEND_DUMMY_EVENT();
-	APPEND_DUMMY_EVENT();
 
 	/* BRIDGE_EXIT alice and david */
 	APPEND_DUMMY_EVENT();
@@ -1558,14 +1550,6 @@
 	do_sleep();
 	HANGUP_CHANNEL(chan_charlie, AST_CAUSE_NORMAL, "");
 	do_sleep();
-
-	/* ;1 and ;2 BRIDGE_EXIT, HANGUP, and CHAN_END */
-	APPEND_DUMMY_EVENT();
-	APPEND_DUMMY_EVENT();
-	APPEND_DUMMY_EVENT();
-	APPEND_DUMMY_EVENT();
-	APPEND_DUMMY_EVENT();
-	APPEND_DUMMY_EVENT();
 
 	return AST_TEST_PASS;
 }
@@ -1800,9 +1784,15 @@
 static void test_sub(struct ast_event *event)
 {
 	struct ast_event *event_dup = ao2_dup_event(event);
+	const char *chan_name;
 	SCOPED_MUTEX(mid_test_lock, &mid_test_sync_lock);
 
 	if (!event_dup) {
+		return;
+	}
+
+	chan_name = ast_event_get_ie_str(event_dup, AST_EVENT_IE_CEL_CHANNAME);
+	if (chan_name && strncmp(chan_name, CHANNEL_TECH_NAME, 14)) {
 		return;
 	}
 
@@ -2130,10 +2120,10 @@
 	AST_TEST_UNREGISTER(test_cel_dial_answer_twoparty_bridge_b);
 #ifdef RACEY_TESTS
 	AST_TEST_UNREGISTER(test_cel_dial_answer_multiparty);
+	AST_TEST_UNREGISTER(test_cel_attended_transfer_bridges_swap);
 #endif
 
 	AST_TEST_UNREGISTER(test_cel_blind_transfer);
-	AST_TEST_UNREGISTER(test_cel_attended_transfer_bridges_swap);
 	AST_TEST_UNREGISTER(test_cel_attended_transfer_bridges_merge);
 	AST_TEST_UNREGISTER(test_cel_attended_transfer_bridges_link);
 
@@ -2205,10 +2195,10 @@
 	AST_TEST_REGISTER(test_cel_dial_answer_twoparty_bridge_b);
 #ifdef RACEY_TESTS
 	AST_TEST_REGISTER(test_cel_dial_answer_multiparty);
+	AST_TEST_REGISTER(test_cel_attended_transfer_bridges_swap);
 #endif
 
 	AST_TEST_REGISTER(test_cel_blind_transfer);
-	AST_TEST_REGISTER(test_cel_attended_transfer_bridges_swap);
 	AST_TEST_REGISTER(test_cel_attended_transfer_bridges_merge);
 	AST_TEST_REGISTER(test_cel_attended_transfer_bridges_link);
 




More information about the svn-commits mailing list