From 04ec8d64217af6094e9c6ae8877424c36e20b5b5 Mon Sep 17 00:00:00 2001
From: "benjamin.franksen" <benjamin.franksen@helmholtz-berlin.de>
Date: Thu, 19 Sep 2013 13:42:15 +0000
Subject: [PATCH] added test for simultaneous pvGetComplete

---
 test/validate/Makefile         |  1 +
 test/validate/pvGetComplete.db |  2 ++
 test/validate/pvGetComplete.st | 60 ++++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 test/validate/pvGetComplete.db
 create mode 100644 test/validate/pvGetComplete.st

diff --git a/test/validate/Makefile b/test/validate/Makefile
index 7e9c7b46..6c7e5515 100644
--- a/test/validate/Makefile
+++ b/test/validate/Makefile
@@ -54,6 +54,7 @@ REGRESSION_TESTS_WITHOUT_DB += userfunc
 REGRESSION_TESTS_WITHOUT_DB += userfuncEf
 
 REGRESSION_TESTS_REMOTE_ONLY += pvGetSync
+REGRESSION_TESTS_REMOTE_ONLY += pvGetComplete
 
 REGRESSION_TESTS += $(REGRESSION_TESTS_WITHOUT_DB)
 REGRESSION_TESTS += $(REGRESSION_TESTS_WITH_DB)
diff --git a/test/validate/pvGetComplete.db b/test/validate/pvGetComplete.db
new file mode 100644
index 00000000..c98324be
--- /dev/null
+++ b/test/validate/pvGetComplete.db
@@ -0,0 +1,2 @@
+record(longout,"pvGetComplete1") {}
+record(longout,"pvGetComplete2") {}
diff --git a/test/validate/pvGetComplete.st b/test/validate/pvGetComplete.st
new file mode 100644
index 00000000..4f49aa92
--- /dev/null
+++ b/test/validate/pvGetComplete.st
@@ -0,0 +1,60 @@
+/*************************************************************************\
+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 pvGetCompleteTest
+
+%%#include "../testSupport.h"
+
+#define NRUNS 50000
+
+entry {
+    seq_test_init(2*NRUNS);
+    testDiag("start");
+}
+
+ss pvGetComplete {
+    int r[2];
+    int w[2];
+    assign r to {"pvGetComplete1","pvGetComplete2"};
+    assign w to {"pvGetComplete1","pvGetComplete2"};
+    int n = 0;
+
+    state count {
+        when (n < NRUNS) {
+            n++;
+        } state test
+        when () {
+        } exit
+    }
+    state test {
+        entry {
+            int i;
+            w[0] = n;
+            w[1] = -n;
+            for (i=0; i<2; i++) {
+                r[i] = 0;
+                pvPut(w[i],SYNC);
+            }
+            for (i=0; i<2; i++) {
+                pvGet(r[i],ASYNC);
+            }
+        }
+        when (delay(2)) {
+            testSkip(2,"completion timeout");
+        } state count
+        when (pvGetComplete(r[0]) && pvGetComplete(r[1])) {
+            int i;
+            for (i=0; i<2; i++) {
+                testOk(r[i]==w[i],"%d==%d",r[i],w[i]);
+            }
+        } state count
+    }
+}
+
+exit {
+    testDiag("exit");
+    seq_test_done();
+}
-- 
GitLab