couchbase 3.2.0 → 3.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. package/README.md +24 -18
  2. package/binding.gyp +88 -85
  3. package/deps/lcb/CMakeLists.txt +1 -1
  4. package/deps/lcb/CONTRIBUTING.md +1 -1
  5. package/deps/lcb/README.markdown +2 -2
  6. package/deps/lcb/RELEASE_NOTES.markdown +99 -14
  7. package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
  8. package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
  9. package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -7
  10. package/deps/lcb/doc/Doxyfile +1 -1
  11. package/deps/lcb/example/CMakeLists.txt +4 -4
  12. package/deps/lcb/example/libuvdirect/main.c +39 -12
  13. package/deps/lcb/example/minimal/durability.cc +149 -0
  14. package/deps/lcb/example/minimal/query.c +11 -9
  15. package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
  16. package/deps/lcb/gyp_config/linux/arm64/config.h +243 -0
  17. package/deps/lcb/include/libcouchbase/couchbase.h +80 -5
  18. package/deps/lcb/include/libcouchbase/error.h +2 -0
  19. package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
  20. package/deps/lcb/include/libcouchbase/tracing.h +2 -2
  21. package/deps/lcb/include/memcached/protocol_binary.h +21 -0
  22. package/deps/lcb/libcouchbase.gyp +347 -349
  23. package/deps/lcb/packaging/deb/control +1 -1
  24. package/deps/lcb/src/analytics/analytics_handle.cc +13 -5
  25. package/deps/lcb/src/analytics/analytics_handle.hh +29 -0
  26. package/deps/lcb/src/bootstrap.cc +6 -3
  27. package/deps/lcb/src/capi/cmd_analytics.cc +12 -1
  28. package/deps/lcb/src/capi/cmd_analytics.hh +30 -0
  29. package/deps/lcb/src/capi/cmd_counter.hh +23 -0
  30. package/deps/lcb/src/capi/cmd_exists.hh +24 -1
  31. package/deps/lcb/src/capi/cmd_get.hh +22 -0
  32. package/deps/lcb/src/capi/cmd_get_replica.hh +23 -0
  33. package/deps/lcb/src/capi/cmd_http.hh +7 -0
  34. package/deps/lcb/src/capi/cmd_query.cc +11 -1
  35. package/deps/lcb/src/capi/cmd_query.hh +31 -0
  36. package/deps/lcb/src/capi/cmd_remove.hh +23 -0
  37. package/deps/lcb/src/capi/cmd_search.cc +6 -0
  38. package/deps/lcb/src/capi/cmd_search.hh +23 -0
  39. package/deps/lcb/src/capi/cmd_store.hh +33 -21
  40. package/deps/lcb/src/capi/cmd_subdoc.hh +35 -0
  41. package/deps/lcb/src/capi/cmd_touch.hh +23 -0
  42. package/deps/lcb/src/capi/cmd_unlock.hh +23 -0
  43. package/deps/lcb/src/capi/cmd_view.hh +6 -0
  44. package/deps/lcb/src/capi/collection_qualifier.hh +2 -2
  45. package/deps/lcb/src/cntl.cc +45 -11
  46. package/deps/lcb/src/crypto.cc +2 -2
  47. package/deps/lcb/src/dns-srv.cc +5 -3
  48. package/deps/lcb/src/errmap.cc +5 -9
  49. package/deps/lcb/src/errmap.h +7 -3
  50. package/deps/lcb/src/handler.cc +24 -18
  51. package/deps/lcb/src/hostlist.h +2 -2
  52. package/deps/lcb/src/http/http-priv.h +2 -2
  53. package/deps/lcb/src/http/http.cc +5 -2
  54. package/deps/lcb/src/instance.cc +20 -11
  55. package/deps/lcb/src/internal.h +9 -0
  56. package/deps/lcb/src/lcbio/connect.cc +14 -2
  57. package/deps/lcb/src/lcbio/connect.h +2 -2
  58. package/deps/lcb/src/lcbio/ctx.cc +4 -2
  59. package/deps/lcb/src/lcbio/ioutils.cc +9 -10
  60. package/deps/lcb/src/lcbio/manager.cc +1 -1
  61. package/deps/lcb/src/mcserver/mcserver.cc +9 -6
  62. package/deps/lcb/src/mcserver/negotiate.cc +39 -17
  63. package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
  64. package/deps/lcb/src/n1ql/query_handle.cc +41 -19
  65. package/deps/lcb/src/n1ql/query_handle.hh +28 -1
  66. package/deps/lcb/src/operations/counter.cc +18 -5
  67. package/deps/lcb/src/operations/exists.cc +25 -4
  68. package/deps/lcb/src/operations/get.cc +39 -19
  69. package/deps/lcb/src/operations/get_replica.cc +28 -8
  70. package/deps/lcb/src/operations/observe.cc +1 -1
  71. package/deps/lcb/src/operations/ping.cc +8 -8
  72. package/deps/lcb/src/operations/pktfwd.cc +2 -1
  73. package/deps/lcb/src/operations/remove.cc +39 -22
  74. package/deps/lcb/src/operations/store.cc +18 -5
  75. package/deps/lcb/src/operations/subdoc.cc +18 -6
  76. package/deps/lcb/src/operations/touch.cc +34 -16
  77. package/deps/lcb/src/operations/unlock.cc +24 -5
  78. package/deps/lcb/src/packetutils.h +3 -2
  79. package/deps/lcb/src/retryq.cc +24 -5
  80. package/deps/lcb/src/search/search.cc +1 -0
  81. package/deps/lcb/src/search/search_handle.cc +30 -8
  82. package/deps/lcb/src/search/search_handle.hh +29 -0
  83. package/deps/lcb/src/settings.cc +1 -1
  84. package/deps/lcb/src/ssl/ssl_common.c +6 -7
  85. package/deps/lcb/src/tracing/span.cc +47 -14
  86. package/deps/lcb/src/tracing/tracer.cc +11 -2
  87. package/deps/lcb/src/tracing/tracing-internal.h +105 -93
  88. package/deps/lcb/src/utilities.cc +43 -0
  89. package/deps/lcb/src/utilities.h +53 -0
  90. package/deps/lcb/src/vbucket/vbucket.c +34 -33
  91. package/deps/lcb/src/views/view_handle.cc +13 -5
  92. package/deps/lcb/src/views/view_handle.hh +29 -0
  93. package/deps/lcb/tests/CMakeLists.txt +21 -0
  94. package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
  95. package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
  96. package/deps/lcb/tests/basic/t_n1qlstrings.cc +73 -0
  97. package/deps/lcb/tests/iotests/mock-environment.cc +30 -1
  98. package/deps/lcb/tests/iotests/mock-environment.h +49 -0
  99. package/deps/lcb/tests/iotests/mock-unit-test.cc +104 -6
  100. package/deps/lcb/tests/iotests/mock-unit-test.h +34 -0
  101. package/deps/lcb/tests/iotests/t_collections.cc +1 -1
  102. package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
  103. package/deps/lcb/tests/iotests/t_get.cc +109 -7
  104. package/deps/lcb/tests/iotests/t_http.cc +9 -4
  105. package/deps/lcb/tests/iotests/t_lock.cc +18 -0
  106. package/deps/lcb/tests/iotests/t_mutate.cc +157 -63
  107. package/deps/lcb/tests/iotests/t_n1ql.cc +330 -33
  108. package/deps/lcb/tests/iotests/t_views.cc +1 -0
  109. package/deps/lcb/tests/iotests/testutil.cc +168 -0
  110. package/deps/lcb/tests/iotests/testutil.h +116 -0
  111. package/deps/lcb/tests/mocksupport/procutil.c +32 -28
  112. package/deps/lcb/tests/mocksupport/server.c +0 -1
  113. package/deps/lcb/tests/mocksupport/timeout.c +2 -2
  114. package/deps/lcb/tools/cbc.cc +7 -0
  115. package/dist/analyticsindexmanager.js +512 -524
  116. package/dist/binding.d.ts +3 -0
  117. package/dist/bindingutilities.js +4 -0
  118. package/dist/bucket.js +1 -1
  119. package/dist/bucketmanager.d.ts +31 -1
  120. package/dist/bucketmanager.js +194 -186
  121. package/dist/cluster.d.ts +7 -0
  122. package/dist/cluster.js +48 -38
  123. package/dist/collection.js +11 -17
  124. package/dist/collectionmanager.js +181 -197
  125. package/dist/connection.d.ts +3 -1
  126. package/dist/connection.js +27 -16
  127. package/dist/couchbase.d.ts +1 -0
  128. package/dist/couchbase.js +3 -13
  129. package/dist/datastructures.js +239 -310
  130. package/dist/diagnosticsexecutor.js +70 -85
  131. package/dist/errors.d.ts +70 -0
  132. package/dist/errors.js +96 -2
  133. package/dist/eventingfunctionmanager.d.ts +804 -0
  134. package/dist/eventingfunctionmanager.js +993 -0
  135. package/dist/httpexecutor.d.ts +2 -1
  136. package/dist/httpexecutor.js +30 -37
  137. package/dist/queryindexmanager.js +240 -266
  138. package/dist/scope.js +10 -4
  139. package/dist/sdspecs.d.ts +1 -1
  140. package/dist/searchexecutor.js +3 -0
  141. package/dist/searchindexmanager.js +240 -271
  142. package/dist/searchquery.d.ts +17 -0
  143. package/dist/searchquery.js +22 -1
  144. package/dist/searchtypes.d.ts +7 -2
  145. package/dist/searchtypes.js +2 -2
  146. package/dist/usermanager.js +251 -264
  147. package/dist/utilities.d.ts +2 -0
  148. package/dist/utilities.js +7 -2
  149. package/dist/viewexecutor.js +1 -1
  150. package/dist/viewindexmanager.js +131 -150
  151. package/package.json +1 -1
  152. package/src/addondata.cpp +58 -0
  153. package/src/addondata.h +40 -0
  154. package/src/binding.cpp +3 -1
  155. package/src/cas.h +2 -2
  156. package/src/connection.cpp +25 -178
  157. package/src/connection.h +8 -65
  158. package/src/connection_ops.cpp +57 -34
  159. package/src/constants.cpp +3 -0
  160. package/src/instance.cpp +235 -0
  161. package/src/instance.h +102 -0
  162. package/src/{connection_callbacks.cpp → instance_callbacks.cpp} +34 -34
  163. package/src/logger.cpp +11 -1
  164. package/src/logger.h +3 -0
  165. package/src/metrics.cpp +10 -0
  166. package/src/metrics.h +3 -0
  167. package/src/mutationtoken.h +2 -2
  168. package/src/opbuilder.h +13 -15
  169. package/src/respreader.cpp +1 -0
  170. package/src/respreader.h +6 -4
  171. package/src/tracespan.h +11 -11
  172. package/src/tracing.cpp +11 -0
  173. package/src/tracing.h +3 -0
  174. package/src/valueparser.h +5 -0
  175. package/deps/lcb/example/observe/durability.c +0 -110
@@ -316,6 +316,10 @@ static std::uint64_t get_manifest_id(lcb_INSTANCE *instance)
316
316
  lcb_cmdgetmanifest_destroy(cmd);
317
317
  lcb_wait(instance, LCB_WAIT_DEFAULT);
318
318
 
319
+ if (result.rc == LCB_ERR_TIMEOUT) {
320
+ return 0;
321
+ }
322
+
319
323
  Json::Value payload;
320
324
  EXPECT_EQ(LCB_SUCCESS, result.rc);
321
325
  EXPECT_FALSE(result.value.empty());
@@ -461,3 +465,167 @@ std::string unique_name(const std::string &prefix)
461
465
  ss << prefix << lcb_next_rand32();
462
466
  return ss.str();
463
467
  }
468
+
469
+ void TestSpan::SetAttribute(std::string key, uint64_t value)
470
+ {
471
+ int_tags[std::move(key)] = value;
472
+ }
473
+
474
+ void TestSpan::SetAttribute(std::string key, std::string value)
475
+ {
476
+ str_tags[std::move(key)] = std::move(value);
477
+ }
478
+
479
+ void TestSpan::End()
480
+ {
481
+ finished = true;
482
+ }
483
+
484
+ TestSpan::TestSpan(std::string span_name)
485
+ {
486
+ name = std::move(span_name);
487
+ }
488
+
489
+ std::shared_ptr<TestSpan> TestTracer::StartSpan(std::string name)
490
+ {
491
+ auto t_span = std::make_shared<TestSpan>(name);
492
+ spans.push_back(t_span);
493
+ return t_span;
494
+ }
495
+
496
+ void TestTracer::reset()
497
+ {
498
+ spans.clear();
499
+ }
500
+
501
+ static void *start_span(lcbtrace_TRACER *tracer, const char *name, void *parent)
502
+ {
503
+ auto test_tracer = static_cast<TestTracer *>(tracer->cookie);
504
+ if (!test_tracer->enabled()) {
505
+ return nullptr;
506
+ }
507
+ auto test_span = test_tracer->StartSpan(std::string(name));
508
+ return test_span.get();
509
+ }
510
+
511
+ static void end_span(void *span)
512
+ {
513
+ if (span == nullptr) {
514
+ return;
515
+ }
516
+ static_cast<TestSpan *>(span)->End();
517
+ }
518
+
519
+ static void add_tag_string(void *span, const char *name, const char *value, size_t value_len)
520
+ {
521
+ if (span == nullptr) {
522
+ return;
523
+ }
524
+ std::string val;
525
+ val.append(value, value_len);
526
+ static_cast<TestSpan *>(span)->SetAttribute(std::string(name), val);
527
+ }
528
+
529
+ static void add_tag_uint64(void *span, const char *name, uint64_t value)
530
+ {
531
+ if (span == nullptr) {
532
+ return;
533
+ }
534
+ static_cast<TestSpan *>(span)->SetAttribute(name, value);
535
+ }
536
+
537
+ void TestTracer::create_lcb_tracer()
538
+ {
539
+ lcbtracer_ = lcbtrace_new(nullptr, LCBTRACE_F_EXTERNAL);
540
+ lcbtracer_->version = 1;
541
+ lcbtracer_->v.v1.start_span = start_span;
542
+ lcbtracer_->v.v1.end_span = end_span;
543
+ lcbtracer_->v.v1.add_tag_string = add_tag_string;
544
+ lcbtracer_->v.v1.add_tag_uint64 = add_tag_uint64;
545
+ lcbtracer_->cookie = static_cast<void *>(this);
546
+ }
547
+
548
+ void TestTracer::destroy_lcb_tracer()
549
+ {
550
+ if (lcbtracer_ != nullptr) {
551
+ lcbtrace_destroy(lcbtracer_);
552
+ delete lcbtracer_;
553
+ lcbtracer_ = nullptr;
554
+ }
555
+ }
556
+
557
+ TestTracer::~TestTracer()
558
+ {
559
+ destroy_lcb_tracer();
560
+ }
561
+
562
+ TestMeter::TestMeter() = default;
563
+
564
+ void TestMeter::reset()
565
+ {
566
+ recorders.clear();
567
+ }
568
+
569
+ void TestValueRecorder::RecordValue(uint64_t value)
570
+ {
571
+ values.push_back(value);
572
+ }
573
+
574
+ std::shared_ptr<TestValueRecorder> TestMeter::ValueRecorder(std::string name,
575
+ std::unordered_map<std::string, std::string> tags)
576
+ {
577
+ auto key = name + ":" + tags["db.couchbase.service"];
578
+ auto op = tags["db.operation"];
579
+ if (!op.empty()) {
580
+ key = key + ":" + op;
581
+ }
582
+ std::shared_ptr<TestValueRecorder> test_recorder;
583
+ if (recorders.find(key) == recorders.end()) {
584
+ test_recorder = std::make_shared<TestValueRecorder>();
585
+ recorders[key] = test_recorder;
586
+ } else {
587
+ test_recorder = recorders[key];
588
+ }
589
+ return test_recorder;
590
+ }
591
+
592
+ static void record_callback(const lcbmetrics_VALUERECORDER *recorder, uint64_t value)
593
+ {
594
+ void *test_recorder;
595
+ lcbmetrics_valuerecorder_cookie(recorder, &test_recorder);
596
+ static_cast<TestValueRecorder *>(test_recorder)->RecordValue(value);
597
+ }
598
+
599
+ static const lcbmetrics_VALUERECORDER *new_recorder(const lcbmetrics_METER *meter, const char *name,
600
+ const lcbmetrics_TAG *tags, size_t ntags)
601
+ {
602
+ std::unordered_map<std::string, std::string> recorder_tags;
603
+ for (int i = 0; i < ntags; i++) {
604
+ recorder_tags[tags[i].key] = tags[i].value;
605
+ }
606
+
607
+ void *test_meter_;
608
+ lcbmetrics_meter_cookie(meter, &test_meter_);
609
+ auto test_meter = static_cast<TestMeter *>(test_meter_);
610
+ auto test_value_recorder = test_meter->ValueRecorder(std::string(name), recorder_tags);
611
+
612
+ lcbmetrics_VALUERECORDER *recorder;
613
+ lcbmetrics_valuerecorder_create(&recorder, test_value_recorder.get());
614
+ lcbmetrics_valuerecorder_record_value_callback(recorder, record_callback);
615
+
616
+ return recorder;
617
+ }
618
+
619
+ void TestMeter::create_lcb_meter()
620
+ {
621
+ lcbmetrics_meter_create(&lcbmeter_, static_cast<void *>(this));
622
+ lcbmetrics_meter_value_recorder_callback(lcbmeter_, new_recorder);
623
+ }
624
+
625
+ void TestMeter::destroy_lcb_meter()
626
+ {
627
+ if (lcbmeter_ != nullptr) {
628
+ lcbmetrics_meter_destroy(lcbmeter_);
629
+ lcbmeter_ = nullptr;
630
+ }
631
+ }
@@ -20,12 +20,19 @@
20
20
  #include <libcouchbase/couchbase.h>
21
21
  #include <libcouchbase/vbucket.h>
22
22
  #include <string>
23
+ #include <memory>
24
+ #include <unordered_map>
23
25
 
24
26
  #define ASSERT_STATUS_EQ(expected, actual) \
25
27
  lcb_STATUS GTEST_CONCAT_TOKEN_(actual_code__, __LINE__) = (actual); \
26
28
  ASSERT_EQ(expected, GTEST_CONCAT_TOKEN_(actual_code__, __LINE__)) \
27
29
  << lcb_strerror_short(expected) << " != " << lcb_strerror_short(GTEST_CONCAT_TOKEN_(actual_code__, __LINE__))
28
30
 
31
+ #define EXPECT_STATUS_EQ(expected, actual) \
32
+ lcb_STATUS GTEST_CONCAT_TOKEN_(actual_code__, __LINE__) = (actual); \
33
+ EXPECT_EQ(expected, GTEST_CONCAT_TOKEN_(actual_code__, __LINE__)) \
34
+ << lcb_strerror_short(expected) << " != " << lcb_strerror_short(GTEST_CONCAT_TOKEN_(actual_code__, __LINE__))
35
+
29
36
  struct Item {
30
37
  void assign(const lcb_RESPGET *resp)
31
38
  {
@@ -207,4 +214,113 @@ void drop_scope(lcb_INSTANCE *instance, const std::string &scope, bool wait = tr
207
214
  void drop_collection(lcb_INSTANCE *instance, const std::string &scope, const std::string &collection, bool wait = true);
208
215
 
209
216
  std::string unique_name(const std::string &);
217
+
218
+ class TestSpan
219
+ {
220
+ public:
221
+ explicit TestSpan(std::string name);
222
+ void SetAttribute(std::string key, std::string value);
223
+ void SetAttribute(std::string key, uint64_t value);
224
+ void End();
225
+
226
+ std::unordered_map<std::string, std::string> str_tags{};
227
+ std::unordered_map<std::string, uint64_t> int_tags{};
228
+ bool finished{false};
229
+ std::string name{};
230
+
231
+ TestSpan *parent{nullptr};
232
+ };
233
+
234
+ class TestTracer
235
+ {
236
+ public:
237
+ TestTracer() = default;
238
+ ~TestTracer();
239
+ std::shared_ptr<TestSpan> StartSpan(std::string name);
240
+
241
+ std::vector<std::shared_ptr<TestSpan>> spans{};
242
+
243
+ void reset();
244
+
245
+ bool set_enabled(bool new_value)
246
+ {
247
+ bool old_value = enabled_;
248
+ enabled_ = new_value;
249
+
250
+ reset();
251
+ destroy_lcb_tracer();
252
+ if (new_value) {
253
+ create_lcb_tracer();
254
+ }
255
+ return old_value;
256
+ }
257
+
258
+ bool enabled() const
259
+ {
260
+ return enabled_;
261
+ }
262
+
263
+ lcbtrace_TRACER *lcb_tracer()
264
+ {
265
+ return lcbtracer_;
266
+ }
267
+
268
+ private:
269
+ void create_lcb_tracer();
270
+ void destroy_lcb_tracer();
271
+
272
+ lcbtrace_TRACER *lcbtracer_{nullptr};
273
+ bool enabled_{false};
274
+ };
275
+
276
+ class TestValueRecorder
277
+ {
278
+ public:
279
+ TestValueRecorder() = default;
280
+ void RecordValue(uint64_t value);
281
+
282
+ std::vector<uint64_t> values{};
283
+ };
284
+
285
+ class TestMeter
286
+ {
287
+ public:
288
+ TestMeter();
289
+ void reset();
290
+ std::shared_ptr<TestValueRecorder> ValueRecorder(std::string name,
291
+ std::unordered_map<std::string, std::string> tags);
292
+
293
+ std::unordered_map<std::string, std::shared_ptr<TestValueRecorder>> recorders{};
294
+
295
+ bool set_enabled(bool new_value)
296
+ {
297
+ bool old_value = enabled_;
298
+ enabled_ = new_value;
299
+
300
+ reset();
301
+ destroy_lcb_meter();
302
+ if (new_value) {
303
+ create_lcb_meter();
304
+ }
305
+ return old_value;
306
+ }
307
+
308
+ bool enabled() const
309
+ {
310
+ return enabled_;
311
+ }
312
+
313
+ lcbmetrics_METER *lcb_meter()
314
+ {
315
+ return lcbmeter_;
316
+ }
317
+
318
+ private:
319
+ void create_lcb_meter();
320
+ void destroy_lcb_meter();
321
+
322
+ lcbmetrics_METER *lcbmeter_{nullptr};
323
+ bool enabled_{false};
324
+ };
325
+
210
326
  #endif
@@ -20,8 +20,6 @@
20
20
  #include <stdio.h>
21
21
 
22
22
  #ifndef _WIN32
23
- #define _XOPEN_SOURCE
24
- #include <stdlib.h>
25
23
  #include <string.h>
26
24
  #include <wordexp.h>
27
25
  #include <fcntl.h> /* O_* */
@@ -51,6 +49,7 @@ static char **clisplit(const char *s)
51
49
  ret[ii] = strdup(p.we_wordv[ii]);
52
50
  }
53
51
  ret[ii] = NULL;
52
+ wordfree(&p);
54
53
  return ret;
55
54
  }
56
55
 
@@ -59,39 +58,44 @@ static int spawn_process_impl(child_process_t *proc)
59
58
  int rv;
60
59
  char **argv;
61
60
 
62
- proc->pid = fork();
63
- if (proc->pid < 0) {
61
+ argv = clisplit(proc->name);
62
+ if (argv == NULL) {
63
+ fprintf(stderr, "Couldn't split arguments: %s\n", proc->name);
64
64
  return -1;
65
65
  }
66
- if (proc->pid > 0) {
67
- return 0;
68
- }
69
-
70
- /** In Child */
71
- argv = clisplit(proc->name);
72
- if (!argv) {
73
- fprintf(stderr, "Couldn't split arguments\n");
74
- exit(EXIT_FAILURE);
66
+ proc->pid = vfork();
67
+ if (proc->pid < 0) {
68
+ for (int i = 0; argv[i] != NULL; ++i) {
69
+ free(argv[i]);
70
+ }
71
+ free(argv);
72
+ return -1;
75
73
  }
76
- if (proc->redirect) {
77
- int fd = open(proc->redirect, O_RDWR | O_CREAT | O_APPEND, 0644);
78
- if (fd < 0) {
79
- perror(proc->redirect);
80
- exit(EXIT_FAILURE);
74
+ if (proc->pid == 0) {
75
+ /** In Child */
76
+ if (proc->redirect) {
77
+ int fd = open(proc->redirect, O_RDWR | O_CREAT | O_APPEND, 0644);
78
+ if (fd < 0) {
79
+ perror(proc->redirect);
80
+ exit(EXIT_FAILURE);
81
+ }
82
+ if (dup2(fd, fileno(stderr)) < 0 || dup2(fd, fileno(stdout)) < 0) {
83
+ perror("dup2");
84
+ exit(EXIT_FAILURE);
85
+ }
86
+ setvbuf(stderr, NULL, _IOLBF, 0);
81
87
  }
82
- if (dup2(fd, fileno(stderr)) < 0 || dup2(fd, fileno(stdout)) < 0) {
83
- perror("dup2");
84
- exit(EXIT_FAILURE);
88
+ rv = execvp(argv[0], argv);
89
+ if (rv < 0) {
90
+ perror(argv[0]);
91
+ return -1;
85
92
  }
86
- setvbuf(stderr, NULL, _IOLBF, 0);
87
93
  }
88
- rv = execvp(argv[0], argv);
89
- if (rv < 0) {
90
- perror(argv[0]);
91
- exit(EXIT_FAILURE);
94
+ for (int i = 0; argv[i] != NULL; ++i) {
95
+ free(argv[i]);
92
96
  }
93
- abort();
94
- return 0; /* make things happy */
97
+ free(argv);
98
+ return 0;
95
99
  }
96
100
 
97
101
  void kill_process(child_process_t *process, int force)
@@ -296,7 +296,6 @@ static int start_mock_server(struct test_server_info *info, char **cmdline)
296
296
 
297
297
  start_mock_process(info, argv);
298
298
  negotiate_mock_connection(info);
299
- sleep(1); /* give it a bit time to initialize itself */
300
299
  return 1;
301
300
  }
302
301
 
@@ -17,12 +17,12 @@
17
17
  #include "config.h"
18
18
  #include <stdio.h>
19
19
  /*
20
- * The current test suite should not take more than 5 minutes to run.
20
+ * The current test suite should not take more than 8 minutes to run.
21
21
  * If you're testing on a really slow system you may set the
22
22
  * environment variable LCB_MAX_TEST_DURATION to the maximum number of
23
23
  * seconds you'd like the tests to take.
24
24
  */
25
- const int max_duration = 300;
25
+ const int max_duration = 480;
26
26
 
27
27
  #ifdef _WIN32
28
28
  static HANDLE hTimer;
@@ -1273,6 +1273,13 @@ void VersionHandler::run()
1273
1273
  #endif
1274
1274
  printf(" SSL Headers: %s\n", OPENSSL_VERSION_TEXT);
1275
1275
  #endif
1276
+ printf(" HAVE_PKCS5_PBKDF2_HMAC: "
1277
+ #ifdef HAVE_PKCS5_PBKDF2_HMAC
1278
+ "yes"
1279
+ #else
1280
+ "no"
1281
+ #endif
1282
+ "\n");
1276
1283
  } else {
1277
1284
  printf(" SSL: NOT SUPPORTED\n");
1278
1285
  }