You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/08/10 18:08:53 UTC

[1/2] qpid-proton git commit: NO-JIRA: [c] add inverted tests to the C test framework

Repository: qpid-proton
Updated Branches:
  refs/heads/master a56b23466 -> f790480d5


NO-JIRA: [c] add inverted tests to the C test framework

Setting c->inverted=true at the top of a test will make it silent
if it fails, and print "UNEXPECTED PASS" if it passes.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/069bb5ff
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/069bb5ff
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/069bb5ff

Branch: refs/heads/master
Commit: 069bb5ff7728aba3e7e4bb89d924b08a2ea1ad4f
Parents: a56b234
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Aug 10 10:38:40 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Aug 10 10:38:40 2018 -0400

----------------------------------------------------------------------
 c/tests/connection_driver.c |  8 ++++----
 c/tests/test_handler.h      | 26 ++++++++++++++------------
 c/tests/test_tools.h        |  7 ++++++-
 3 files changed, 24 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/069bb5ff/c/tests/connection_driver.c
----------------------------------------------------------------------
diff --git a/c/tests/connection_driver.c b/c/tests/connection_driver.c
index 796c262..16d75a3 100644
--- a/c/tests/connection_driver.c
+++ b/c/tests/connection_driver.c
@@ -491,11 +491,13 @@ static void test_duplicate_link_server(test_t *t) {
   test_connection_drivers_destroy(&client, &server);
 }
 
-/* Regression test for https://issues.apache.org/jira/browse/PROTON-1832.
+/* Reproducer test for https://issues.apache.org/jira/browse/PROTON-1832.
    Make sure the client does not generate an illegal "attach; attach; detach" sequence
    from a legal "pn_link_open(); pn_link_close(); pn_link_open()" sequence
 */
 static void test_duplicate_link_client(test_t *t) {
+  /* This test will fail till PROTON-1832 is fully fixed */
+  t->inverted = true;
   /* Set up the initial link */
   test_connection_driver_t client, server;
   test_connection_drivers_init(t, &client, open_close_handler, &server, open_close_handler);
@@ -536,8 +538,6 @@ int main(int argc, char **argv) {
   RUN_ARGV_TEST(failed, t, test_message_abort_mixed(&t));
   RUN_ARGV_TEST(failed, t, test_session_flow_control(&t));
   RUN_ARGV_TEST(failed, t, test_duplicate_link_server(&t));
-  fprintf(stderr, "\n==== Following tests are expected to fail ====\n");
-  int ignore = 0;               /* run but don't fail the build */
-  RUN_ARGV_TEST(ignore, t, test_duplicate_link_client(&t));
+  RUN_ARGV_TEST(failed, t, test_duplicate_link_client(&t));
   return failed;
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/069bb5ff/c/tests/test_handler.h
----------------------------------------------------------------------
diff --git a/c/tests/test_handler.h b/c/tests/test_handler.h
index 7ffd4d3..8799fb3 100644
--- a/c/tests/test_handler.h
+++ b/c/tests/test_handler.h
@@ -83,19 +83,21 @@ void test_etypes_expect_(test_t *t, pn_event_type_t *etypes, size_t size, const
   }
   if (i < size || want) {
     test_errorf_(t, NULL, file, line, "event mismatch");
-    fprintf(stderr, "after:");
-    for (size_t j = 0; j < i; ++j) { /* These events matched */
-      fprintf(stderr, " %s", pn_event_type_name(etypes[j]));
+    if (!t->inverted) {
+      fprintf(stderr, "after:");
+      for (size_t j = 0; j < i; ++j) { /* These events matched */
+        fprintf(stderr, " %s", pn_event_type_name(etypes[j]));
+      }
+      fprintf(stderr, "\n want:");
+      for (; want; want = (pn_event_type_t)va_arg(ap, int)) {
+        fprintf(stderr, " %s", pn_event_type_name(want));
+      }
+      fprintf(stderr, "\n  got:");
+      for (; i < size; ++i) {
+        fprintf(stderr, " %s", pn_event_type_name(etypes[i]));
+      }
+      fprintf(stderr, "\n");
     }
-    fprintf(stderr, "\n want:");
-    for (; want; want = (pn_event_type_t)va_arg(ap, int)) {
-      fprintf(stderr, " %s", pn_event_type_name(want));
-    }
-    fprintf(stderr, "\n  got:");
-    for (; i < size; ++i) {
-      fprintf(stderr, " %s", pn_event_type_name(etypes[i]));
-    }
-    fprintf(stderr, "\n");
   }
   va_end(ap);
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/069bb5ff/c/tests/test_tools.h
----------------------------------------------------------------------
diff --git a/c/tests/test_tools.h b/c/tests/test_tools.h
index 55dba75..6910450 100644
--- a/c/tests/test_tools.h
+++ b/c/tests/test_tools.h
@@ -44,6 +44,7 @@ typedef struct test_t {
   const char* name;
   int errors;
   uintptr_t data;               /* Test can store some non-error data here */
+  bool inverted;                /* An inverted test prints no output and reports failure if it passes */
 } test_t;
 
 /* Internal, use macros. Print error message and increase the t->errors count.
@@ -52,6 +53,7 @@ typedef struct test_t {
 void test_vlogf_(test_t *t, const char *prefix, const char* expr,
                  const char* file, int line, const char *fmt, va_list ap)
 {
+  if (t->inverted) return;
   fprintf(stderr, "%s:%d", file, line);
   if (prefix && *prefix) fprintf(stderr, ": %s", prefix);
   if (expr && *expr) fprintf(stderr, ": %s", expr);
@@ -186,9 +188,12 @@ bool test_str_equal_(test_t *t, const char* want, const char* got, const char *f
     fflush(stdout);                                                     \
     test_t T = { #EXPR, 0 };                                            \
     (EXPR);                                                             \
-    if (T.errors) {                                                     \
+    if (T.errors && !t.inverted) {                                      \
       fprintf(stderr, "FAIL: %s (%d errors)\n", #EXPR, T.errors);       \
       ++(FAILED);                                                       \
+    } else if (!T.errors && t.inverted) {                               \
+      fprintf(stderr, "UNEXPECTED PASS: %s", #EXPR);                    \
+      ++(FAILED);                                                       \
     }                                                                   \
   } while(0)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[2/2] qpid-proton git commit: PROTON-1912: [ruby] explicit path for swig output

Posted by ac...@apache.org.
PROTON-1912: [ruby] explicit path for swig output

Recent cmake (observed on cmake-3.12.0-1.fc29.x86_64) changed the default
directory for swig output files. This patch explicitly sets the output directory
so files are in a known place, and can be copied when making the gem.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/f790480d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/f790480d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/f790480d

Branch: refs/heads/master
Commit: f790480d54745e73f45a0bc8a49df7ac554d16b0
Parents: 069bb5f
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Aug 9 09:23:40 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Aug 10 14:07:55 2018 -0400

----------------------------------------------------------------------
 ruby/CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f790480d/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/ruby/CMakeLists.txt b/ruby/CMakeLists.txt
index 59486f9..848d1c9 100644
--- a/ruby/CMakeLists.txt
+++ b/ruby/CMakeLists.txt
@@ -29,6 +29,8 @@ list(APPEND SWIG_MODULE_cproton-ruby_EXTRA_DEPS
     )
 
 set(CMAKE_SWIG_FLAGS "-DUINTPTR_SIZE=${CMAKE_SIZEOF_VOID_P}")
+# Put the generated source in a known place, we need to copy it for the gem.
+set(SWIG_OUTFILE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
 
 include_directories(${PN_C_INCLUDE_DIR} ${RUBY_INCLUDE_PATH})
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org