
_This change is the thing I suggested to redis when it was BSD, and is not just migration - this is of course more advanced_ ### Issue There is weird difference in syntax between BITPOS and BITCOUNT: ``` BITPOS key bit [start [end [BYTE | BIT]]] BITCOUNT key [start end [BYTE | BIT]] ``` I think this might cause confusion in terms of usability. It was not just a syntax typo error, and really works differently. The results below are with unstable build: ``` > get TEST:ABCD "ABCD" > BITPOS TEST:ABCD 1 0 -1 (integer) 1 > BITCOUNT TEST:ABCD 0 -1 (integer) 9 > BITPOS TEST:ABCD 1 0 (integer) 1 > BITCOUNT TEST:ABCD 0 (error) ERR syntax error ``` ### What did I fix simply changes logic, to accept BITCOUNT also without 'end' - 'end' become optional, like BITPOS ``` > GET TEST:ABCD "ABCD" > BITPOS TEST:ABCD 1 0 -1 (integer) 1 > BITCOUNT TEST:ABCD 0 -1 (integer) 9 > BITPOS TEST:ABCD 1 0 (integer) 1 > BITCOUNT TEST:ABCD 0 (integer) 9 ``` Of course, I also fixed syntax hint: ``` # ASIS > BITCOUNT key [start end [BYTE|BIT]] # TOBE > BITCOUNT key [start [end [BYTE|BIT]]] ```  ### Moreover ... I hadn't noticed that there was very small dead code in these command logic, when I wrote PR to redis. I found it now, when write code again, so I wrote it in valkey. ``` c /* asis unstable */ /* bitcountCommand() */ if (!strcasecmp(c->argv[4]->ptr,"bit")) isbit = 1; // ... if (c->argc < 4) { if (isbit) end = (totlen<<3) + 7; else end = totlen-1; } /* bitposCommand() */ if (!strcasecmp(c->argv[5]->ptr,"bit")) isbit = 1; // ... if (c->argc < 5) { if (isbit) end = (totlen<<3) + 7; else end = totlen-1; } ``` Bit variable (actually int) "isbit" is only being set as 1, when 'BIT' is declared. But we were checking whether 'isbit' is true or false in this 'if' phrase, even if isbit could never be 1, because argc is always less than 4 (or 5 in bitpos). I think this minor fixes will make valkey command operation more consistent. Of course, this PR contains just changing args from "required" to "optional", so it will never hurt previous users. Thanks, --------- Signed-off-by: LiiNen <kjeonghoon065@gmail.com> Co-authored-by: Madelyn Olson <34459052+madolson@users.noreply.github.com>
Valkey Test Suite
The normal execution mode of the test suite involves starting and manipulating
local valkey-server
instances, inspecting process state, log files, etc.
The test suite also supports execution against an external server, which is
enabled using the --host
and --port
parameters. When executing against an
external server, tests tagged external:skip
are skipped.
There are additional runtime options that can further adjust the test suite to match different external server configurations:
Option | Impact |
---|---|
--singledb |
Only use database 0, don't assume others are supported. |
--ignore-encoding |
Skip all checks for specific encoding. |
--ignore-digest |
Skip key value digest validations. |
--cluster-mode |
Run in strict Valkey Cluster compatibility mode. |
--large-memory |
Enables tests that consume more than 100mb |
Tags
Tags are applied to tests to classify them according to the subsystem they test, but also to indicate compatibility with different run modes and required capabilities.
Tags can be applied in different context levels:
start_server
contexttags
context that bundles several tests together- A single test context.
The following compatibility and capability tags are currently used:
Tag | Indicates |
---|---|
external:skip |
Not compatible with external servers. |
cluster:skip |
Not compatible with --cluster-mode . |
large-memory |
Test that requires more than 100mb |
tls:skip |
Not compatible with --tls . |
needs:repl |
Uses replication and needs to be able to SYNC from server. |
needs:debug |
Uses the DEBUG command or other debugging focused commands (like OBJECT REFCOUNT ). |
needs:pfdebug |
Uses the PFDEBUG command. |
needs:config-maxmemory |
Uses CONFIG SET to manipulate memory limit, eviction policies, etc. |
needs:config-resetstat |
Uses CONFIG RESETSTAT to reset statistics. |
needs:reset |
Uses RESET to reset client connections. |
needs:save |
Uses SAVE or BGSAVE to create an RDB file. |
When using an external server (--host
and --port
), filtering using the
external:skip
tags is done automatically.
When using --cluster-mode
, filtering using the cluster:skip
tag is done
automatically.
When not using --large-memory
, filtering using the largemem:skip
tag is done
automatically.
In addition, it is possible to specify additional configuration. For example, to
run tests on a server that does not permit SYNC
use:
./runtest --host <host> --port <port> --tags -needs:repl