From d72e792e988accbed3c60bfa989f05a11aeaeca2 Mon Sep 17 00:00:00 2001
From: Christopher Haine <chaine@uan01-nmn.local>
Date: Tue, 13 Jul 2021 11:52:21 -0500
Subject: [PATCH] fix AND/OR selectors

---
 maestro/cdo_sel_parse.c   | 2 +-
 maestro/cdo_sel_parse.peg | 2 +-
 maestro/pool.c            | 2 --
 tests/ecmwf_consumer.c    | 2 +-
 tests/ecmwf_producer.c    | 2 ++
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/maestro/cdo_sel_parse.c b/maestro/cdo_sel_parse.c
index c6f1aa92..0da940bc 100644
--- a/maestro/cdo_sel_parse.c
+++ b/maestro/cdo_sel_parse.c
@@ -3232,7 +3232,7 @@ void mstro_csq_destroy(mstro_csq_context_t *ctx) {
 
 #define MIN(x,y) ((x)<(y) ? (x) : (y))
 
-#line 370 "cdo_sel_parse.peg"
+#line 388 "cdo_sel_parse.peg"
 void
 mstro_csq_val__describe(const struct mstro_csq_val *v, size_t indent)
 {
diff --git a/maestro/cdo_sel_parse.peg b/maestro/cdo_sel_parse.peg
index 8360d84e..c4eb4391 100644
--- a/maestro/cdo_sel_parse.peg
+++ b/maestro/cdo_sel_parse.peg
@@ -384,7 +384,7 @@ EOF  <- !.
 
 #define MIN(x,y) ((x)<(y) ? (x) : (y))
 
-#line 370 "cdo_sel_parse.peg"
+#line 388 "cdo_sel_parse.peg"
 void
 mstro_csq_val__describe(const struct mstro_csq_val *v, size_t indent)
 {
diff --git a/maestro/pool.c b/maestro/pool.c
index b9a655ad..f4fe5da2 100644
--- a/maestro/pool.c
+++ b/maestro/pool.c
@@ -1315,7 +1315,6 @@ mstro__csq_validate(struct mstro_csq_val *csq,
       return MSTRO_FAIL;
 
     case MSTRO_CSQ_OR: {
-      assert(csq->next==NULL);
       struct mstro_csq_val *tmp;
       mstro_status s=MSTRO_OK;
       LL_FOREACH(csq->or.clauses, tmp) {
@@ -1329,7 +1328,6 @@ mstro__csq_validate(struct mstro_csq_val *csq,
     }
 
     case MSTRO_CSQ_AND: {
-      assert(csq->next==NULL);
       struct mstro_csq_val *tmp;
       mstro_status s=MSTRO_OK;
       LL_FOREACH(csq->and.terms, tmp) {
diff --git a/tests/ecmwf_consumer.c b/tests/ecmwf_consumer.c
index 13636068..11ff617d 100644
--- a/tests/ecmwf_consumer.c
+++ b/tests/ecmwf_consumer.c
@@ -10,7 +10,7 @@ int main(int argc, char *argv[])
     mstro_subscription subscription = NULL;
 
     assert(MSTRO_OK == mstro_init(getenv("MSTRO_WORKFLOW_NAME"), getenv("MSTRO_COMPONENT_NAME"), 0));
-    assert(MSTRO_OK == mstro_cdo_selector_create(NULL, NULL, "(.maestro.ecmwf.step = 2)", &selector));
+    assert(MSTRO_OK == mstro_cdo_selector_create(NULL, NULL, "(and (.maestro.ecmwf.step = 2) (.maestro.ecmwf.number = 1))", &selector));
     assert(MSTRO_OK == mstro_subscribe(selector, MSTRO_POOL_EVENT_OFFER, false, &subscription));
     assert(MSTRO_OK == mstro_cdo_selector_dispose(selector));
 
diff --git a/tests/ecmwf_producer.c b/tests/ecmwf_producer.c
index baf85afd..23d499b7 100644
--- a/tests/ecmwf_producer.c
+++ b/tests/ecmwf_producer.c
@@ -10,7 +10,9 @@ int main(int argc, char *argv[])
     mstro_cdo cdo = NULL;
     assert(MSTRO_OK == mstro_cdo_declare("my-cdo-1", MSTRO_ATTR_DEFAULT, &cdo));
     int64_t step = 2;
+    int64_t number = 1;
     assert(MSTRO_OK == mstro_cdo_attribute_set(cdo, ".maestro.ecmwf.step", (void **)&step, true));
+    assert(MSTRO_OK == mstro_cdo_attribute_set(cdo, ".maestro.ecmwf.number", (void **)&number, true));
     assert(MSTRO_OK == mstro_cdo_seal(cdo));
     assert(MSTRO_OK == mstro_cdo_offer(cdo));
     sleep(5); // sleep until we fix acknowledge issue
-- 
GitLab