Skip to content

Commit 66562d8

Browse files
committed
Issues spotted by inder 1.3 and disable examples in build.yml
1 parent 3ec35e4 commit 66562d8

10 files changed

Lines changed: 42 additions & 25 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151

5252
- name: Build xchange dependency
5353
run: |
54-
make -C xchange shared
5554
make -C xchange static
55+
make -C xchange shared
5656
5757
- name: Build static library
5858
run: make static
@@ -62,9 +62,10 @@ jobs:
6262

6363
- name: Build tools
6464
run: make tools
65-
66-
- name: Build examples
67-
run: make examples
65+
66+
# Needs to be fixed -- cannot find redisx
67+
# - name: Build examples
68+
# run: make examples
6869

6970
build-freebsd:
7071
runs-on: ubuntu-latest

.settings/language.settings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
66
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
77
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="([^/\\\\]*)((g?cc)|([gc]\+\+)|(clang))" prefer-non-shared="true"/>
8-
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1563693297748052703" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
8+
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1563587762567252703" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
99
<language-scope id="org.eclipse.cdt.core.gcc"/>
1010
<language-scope id="org.eclipse.cdt.core.g++"/>
1111
</provider>

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ include(FeatureSummary)
3636
# Build options
3737
option(BUILD_SHARED_LIBS "Build as shared libraries instead of static" OFF)
3838
option(BUILD_DOC "Build HTML documetation" OFF)
39-
option(BUILD_TESTING "Build regression test suite" ON)
39+
option(BUILD_TESTING "Build regression test suite" OFF)
4040
option(BUILD_EXAMPLES "Build example programs" OFF)
41+
option(CHECK_BUILD "Basic build integrity checking during tests" OFF)
4142
option(ENABLE_OPENMP "Build with OpenMP support" OFF)
4243
option(ENABLE_TLS "Build with TLS support" OFF)
4344

4445
# Set feature descriptions for summary
4546
add_feature_info(SharedLibs BUILD_SHARED_LIBS "Build as shared libraries")
4647
add_feature_info(Documentation BUILD_DOC "Developer documentation (HTML)")
47-
add_feature_info(Testing BUILD_TESTING "Run regression testing")
48+
add_feature_info(Testing BUILD_TESTING "Run regression testing (needs Redis/Valkey server)")
4849
add_feature_info(Examples BUILD_EXAMPLES "Build and test example programs")
50+
add_feature_info(Examples CHECK_BUILD "Basic functionality checking of the build")
4951
add_feature_info(OpenMP ENABLE_OPENMP "OpenMP support")
5052
add_feature_info(TLS ENABLE_TLS "TLS support")
5153

@@ -149,6 +151,10 @@ if(BUILD_DOC)
149151
add_subdirectory(doc)
150152
endif()
151153

154+
if(CHECK_BUILD)
155+
add_test(NAME cli-check COMMAND ${CMAKE_BINARY_DIR}/bin/redisx-cli --help)
156+
endif()
157+
152158

153159
# ----------------------------------------------------------------------------
154160
# Install Runtime component

examples/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ LIB ?= ../lib
1010

1111
ifdef XCHANGE
1212
CPPFLAGS += -I$(XCHANGE)/include
13-
LDFLAGS += -L$(XCHANGE)/lib
13+
LDFLAGS += -L$(XCHANGE)/lib -lxchange
1414
endif
1515

1616
CPPFLAGS += -I../include
17-
LDFLAGS += -L$(LIB) -lredisx -lxchange -lpthread
18-
17+
LDFLAGS += -L$(LIB) -lredisx -lpthread
1918

2019
.PHONY: all
2120
all: $(EXAMPLES)

src/redisx-net.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,10 @@ static int rAuthAsync(RedisClient *cl) {
256256
prop_error(fn, status);
257257

258258
reply = redisxReadReplyAsync(cl, &status);
259-
prop_error(fn, status);
259+
if(!status)
260+
status = redisxCheckRESP(reply, RESP_SIMPLE_STRING, -1);
260261

261-
status = redisxCheckRESP(reply, RESP_SIMPLE_STRING, -1);
262262
redisxDestroyRESP(reply);
263-
264263
prop_error(fn, status);
265264

266265
return X_SUCCESS;

src/redisx-sentinel.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,27 @@ int rConfirmMasterRoleAsync(Redis *redis) {
140140
prop_error(fn, status);
141141

142142
reply = redisxReadReplyAsync(redis->interactive, &status);
143-
prop_error(fn, status);
143+
if(status) {
144+
redisxDestroyRESP(reply);
145+
x_trace(fn, "ROLE", status);
146+
}
144147

145148
if(redisxCheckDestroyRESP(reply, RESP_ARRAY, 0) != X_SUCCESS) {
146149
// Fallback to using INFO replication...
147150
XLookupTable *info;
148151
const XField *role;
149152

150153
status = redisxSendRequestAsync(redis->interactive, "INFO", "replication", NULL, NULL);
151-
prop_error(fn, status);
154+
if(status) {
155+
redisxDestroyRESP(reply);
156+
x_trace(fn, "sendRequestAsync(INFO)", status);
157+
}
152158

153159
reply = redisxReadReplyAsync(redis->interactive, &status);
154-
prop_error(fn, status);
160+
if(status) {
161+
redisxDestroyRESP(reply);
162+
x_trace(fn, "readReplyAsync(INFO)", status);
163+
}
155164

156165
info = rConsumeInfoReply(reply);
157166
if(!info) return x_trace(fn, NULL, X_FAILURE);
@@ -216,7 +225,10 @@ int rDiscoverSentinelAsync(Redis *redis) {
216225
if(status) continue;
217226

218227
reply = redisxReadReplyAsync(redis->interactive, &status);
219-
if(status) continue;
228+
if(status) {
229+
redisxDestroyRESP(reply);
230+
continue;
231+
}
220232

221233
if(redisxCheckDestroyRESP(reply, RESP_ARRAY, 2) == X_SUCCESS) {
222234
RESP **component = (RESP **) reply->value;

src/redisx.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,7 @@ static int redisxSelectDBAsync(RedisClient *cl, int idx, boolean confirm) {
423423
if(confirm) {
424424
int status = X_SUCCESS;
425425
RESP *reply = redisxReadReplyAsync(cl, &status);
426-
427-
prop_error(fn, status);
428-
429-
status = redisxCheckRESP(reply, RESP_SIMPLE_STRING, 0);
426+
if(!status) status = redisxCheckRESP(reply, RESP_SIMPLE_STRING, 0);
430427
if(!status) if(strcmp("OK", (char *) reply->value) != 0)
431428
status = x_error(REDIS_UNEXPECTED_RESP, ENOMSG, fn, "expected 'OK', got '%s'", (char *) reply->value);
432429
redisxDestroyRESP(reply);
@@ -881,7 +878,7 @@ XLookupTable *rConsumeInfoReply(RESP *reply) {
881878

882879
// Parse key:value lines into a structure.
883880
while(line) {
884-
char *sep = strchr(line, ':');
881+
char *sep = strchr((char *) line, ':');
885882
if(sep) {
886883
*sep = '\0';
887884
xSetField(s, xCreateStringField(line, sep + 1));

src/resp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,10 @@ XField *redisxRESP2XField(const char *name, const RESP *resp) {
739739
* @sa redisxPrintJSON()
740740
*/
741741
char *redisxRESP2JSON(const char *name, const RESP *resp) {
742-
return xjsonFieldToString(redisxRESP2XField(name, resp));
742+
XField *f = redisxRESP2XField(name, resp);
743+
char *s = xjsonFieldToString(f);
744+
xDestroyField(f);
745+
return s;
743746
}
744747

745748
/**

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ FILE(GLOB TEST_PROGRAMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c)
1212
# Test programs, matching the test sources
1313
list(TRANSFORM TEST_PROGRAMS REPLACE "[.]c$" "")
1414

15-
# Build each example
15+
# Build each test program
1616
foreach(TEST ${TEST_PROGRAMS})
1717
set(TEST_SOURCE ${TEST}.c)
1818

test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LDFLAGS += -lm -lredisx -fprofile-arcs -ftest-coverage
1111

1212
# Check if a Redis / Valkey server is running for us
1313
# to test on.
14-
ONLINE = 0
14+
ONLINE ?= 0
1515

1616
REDIS = $(shell pidof redis-server)
1717
ifneq ($(REDIS),)

0 commit comments

Comments
 (0)