From 6d7ef7d6410919db7ba59804dda7f0614f652ddc Mon Sep 17 00:00:00 2001
From: "benjamin.franksen" <benjamin.franksen@helmholtz-berlin.de>
Date: Mon, 15 Jul 2013 21:54:31 +0000
Subject: [PATCH] added a test for using event flag in C function [amended for
 branch-2-2]

---
 test/validate/Makefile      |  1 +
 test/validate/userfuncEf.st | 54 +++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 test/validate/userfuncEf.st

diff --git a/test/validate/Makefile b/test/validate/Makefile
index 4cac5ccb..e83c35c6 100644
--- a/test/validate/Makefile
+++ b/test/validate/Makefile
@@ -51,6 +51,7 @@ REGRESSION_TESTS_WITHOUT_DB += safeModeNotAssigned
 REGRESSION_TESTS_WITHOUT_DB += safeMonitor
 REGRESSION_TESTS_WITHOUT_DB += sizeof
 REGRESSION_TESTS_WITHOUT_DB += userfunc
+REGRESSION_TESTS_WITHOUT_DB += userfuncEf
 
 REGRESSION_TESTS_REMOTE_ONLY += pvGetSync
 
diff --git a/test/validate/userfuncEf.st b/test/validate/userfuncEf.st
new file mode 100644
index 00000000..84c2f98d
--- /dev/null
+++ b/test/validate/userfuncEf.st
@@ -0,0 +1,54 @@
+/*************************************************************************\
+Copyright (c) 2010-2012 Helmholtz-Zentrum Berlin f. Materialien
+                        und Energie GmbH, Germany (HZB)
+This file is distributed subject to a Software License Agreement found
+in the file LICENSE that is included with this distribution.
+\*************************************************************************/
+program userfuncEfTest
+
+%%#include "../testSupport.h"
+
+option +s;
+
+evflag x;
+
+%{
+static void efSet_x(SS_ID ssId, EV_ID x)
+{
+    seq_efSet(ssId, x);
+}
+}%
+
+foreign pVar, ssId;
+
+entry {
+    seq_test_init(2);
+}
+
+ss myss {
+    state check_not_set {
+        when (efTestAndClear(x)) {
+            testFail("argh, no timeout!");
+        } state set
+        when (delay(0.5)) {
+            testPass("cool, we came here");
+        } state set
+    }
+    state set {
+        when () {
+            efSet_x(ssId(), x);
+        } state check_set
+    }
+    state check_set {
+        when (efTestAndClear(x)) {
+            testPass("cool, we came here");
+        } exit
+        when (delay(0.5)) {
+            testFail("argh, timeout!");
+        } exit
+    }
+}
+
+exit {
+    seq_test_done();
+}
-- 
GitLab