Priyaranjan Mudliar
04/11/2024, 3:06 PMpactffi_verifier_broker_source_with_selectors
2024-04-11T15:03:22.613421Z DEBUG ThreadId(10) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_new_for_application FFI function invoked
2024-04-11T15:03:22.613463Z DEBUG ThreadId(10) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_provider_info FFI function invoked
2024-04-11T15:03:22.613480Z DEBUG ThreadId(10) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_add_provider_transport FFI function invoked
2024-04-11T15:03:22.613495Z DEBUG ThreadId(10) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_provider_state FFI function invoked
2024-04-11T15:03:22.613532Z DEBUG ThreadId(10) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_verification_options FFI function invoked
2024-04-11T15:03:22.613546Z DEBUG ThreadId(10) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_publish_options FFI function invoked
broker_url Variable: <http://localhost:9292/>
broker_username Variable: pact_workshop
broker_password Variable: pact_workshop
enable_pending Variable: 1
branch Variable: develop
consumer_version_selectors Variable: {}
consumer_version_selectors_len Variable: 0
2024-04-11T15:03:22.613621Z DEBUG ThreadId(10) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_broker_source_with_selectors FFI function invoked
2024-04-11T15:03:22.613640Z DEBUG ThreadId(10) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_execute FFI function invoked
2024-04-11T15:03:22.613651Z DEBUG ThreadId(10) pact_ffi::verifier::handle: Pact source to verify = PactBrokerWithDynamicConfiguration(<http://localhost:9292/>, provider_name='animal_service', enable_pending=true, include_wip_since=None, provider_tags=[], provider_branch=Some("develop"), consumer_version_selectors='[], auth=User(pact_workshop, pact*********)')
2024-04-11T15:03:22.749605Z INFO ThreadId(10) pact_verifier::pact_broker: Fetching path '/' from pact broker
make: *** [Makefile:13: test] Segmentation fault (core dumped)
Any pointers as to what might be causing this or how should i debug this?Joshua Ellis
04/11/2024, 11:08 PM/
, but before it even gets a chance to receive a response. Perhaps there's something malformated within the selectors?rholshausen
04/11/2024, 11:11 PMPriyaranjan Mudliar
04/12/2024, 3:02 AMPriyaranjan Mudliar
04/12/2024, 3:08 AMPriyaranjan Mudliar
04/12/2024, 3:08 AMPriyaranjan Mudliar
04/12/2024, 8:45 AMJoshua Ellis
04/12/2024, 11:37 AMPriyaranjan Mudliar
04/12/2024, 12:09 PM/* niftest.c */
#include <pact.h>
#include <string.h>
#include <stdio.h>
int test_pactffi() {
printf("Verification Start--------------------\n");
char *name = "animal_service";
char *scheme = "http";
char *host = "localhost";
int port = 8080;
char *path = "/";
char *version = "default";
char *branch = "develop";
char *broker_url = "<http://localhost:9292/>";
// OSS pact broker docker image: pactfoundation/pact-broker
char *broker_username = "pact_workshop";
char *broker_password = "pact_workshop";
int enable_pending = 1;
char *consumer_version_selectors = "{}";
int consumer_version_selectors_len = 0;
char *protocol = "http";
char *state_path = "<http://localhost:8080/pactStateChange>";
struct VerifierHandle *verifierhandle;
verifierhandle = pactffi_verifier_new_for_application(name, version);
pactffi_verifier_set_provider_info(verifierhandle, name, scheme, host, port, path);
pactffi_verifier_add_provider_transport(verifierhandle, protocol, port, path, scheme);
if (state_path[0] != '\0')
{
pactffi_verifier_set_provider_state(verifierhandle, state_path, 0, 1);
}
pactffi_verifier_set_verification_options(verifierhandle, 0, 5000),
pactffi_verifier_set_publish_options(verifierhandle, version, NULL, NULL, -1, branch);
pactffi_verifier_broker_source_with_selectors(verifierhandle, broker_url, broker_username, broker_password, NULL, enable_pending, NULL, NULL, -1, branch, consumer_version_selectors, consumer_version_selectors_len, NULL, -1);
setenv("PACT_DO_NOT_TRACK", "true", 1);
int output = pactffi_verifier_execute(verifierhandle);
pactffi_verifier_shutdown(verifierhandle);
printf("Verification End------------------------\n");
return output;
}
int main() {
// Function call
pactffi_logger_init();
pactffi_logger_attach_sink("stdout", 5);
pactffi_logger_apply();
int output = test_pactffi();
printf("Output is ------ %d\n", output);
return 0;
}
Priyaranjan Mudliar
04/12/2024, 12:45 PMgcc -O2 -Wmissing-prototypes -Wall -shared -o /home/ranjan/work/pact_erlang/libpact_ffi.so /home/ranjan/work/pact_erlang/c_src/pactffi_test.c -I/home/ranjan/work/pact_erlang/c_src/include /home/ranjan/work/pact_erlang/priv/libpact_ffi-linux-x86_64.a
Step 2: Compile the pactffi_test.c
gcc -c -I./c_src/include ./c_src/pactffi_test.c
Step 3: Get the executable to run:
gcc -O2 -Wmissing-prototypes -Wall -shared -o pactffi_test -L. pactffi_test.o -lpact_ffi
I am still getting segmentation fault, even after I remove the pact ffi calls from my c file.Priyaranjan Mudliar
04/13/2024, 5:33 AMJoshua Ellis
04/13/2024, 5:48 AM