Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate zmalloc.c unit tests to new test framework #459

Closed
wants to merge 31 commits into from

Conversation

karthyuom
Copy link
Contributor

This PR migrates all tests related to zmalloc into new test framework as part of the parent issue #428.

Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 45.00000% with 55 lines in your changes are missing coverage. Please review.

Project coverage is 69.80%. Comparing base (ba9dd7b) to head (41a8e96).
Report is 22 commits behind head on unstable.

❗ Current head 41a8e96 differs from pull request most recent head 9860bd0. Consider uploading reports for the commit 9860bd0 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable     #459      +/-   ##
============================================
+ Coverage     68.95%   69.80%   +0.84%     
============================================
  Files           109      109              
  Lines         61793    61801       +8     
============================================
+ Hits          42611    43138     +527     
+ Misses        19182    18663     -519     
Files Coverage Δ
src/anet.c 70.41% <100.00%> (ø)
src/aof.c 80.85% <ø> (+0.05%) ⬆️
src/asciilogo.h 100.00% <ø> (ø)
src/cluster_legacy.c 86.14% <100.00%> (+2.94%) ⬆️
src/crccombine.c 100.00% <ø> (ø)
src/eval.c 55.45% <ø> (ø)
src/functions.c 95.62% <ø> (ø)
src/kvstore.c 96.65% <ø> (+0.25%) ⬆️
src/latency.c 81.49% <ø> (+0.25%) ⬆️
src/listpack.c 90.05% <ø> (ø)
... and 22 more

... and 13 files with indirect coverage changes

@karthyuom karthyuom changed the title Migrate zmalloc unit tests to new test framework Migrate zmalloc.c unit tests to new test framework May 10, 2024
@karthyuom
Copy link
Contributor Author

Same as this #458 (comment), I didn't remove legacy zmalloc_test due to the conflict. And, I will raise a follow-up PR to remove them together.

@madolson In the meantime, could you please review and merge this PR, thanks.

@madolson madolson mentioned this pull request May 12, 2024
12 tasks
Copy link
Member

@madolson madolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly lgtm.

src/unit/test_zmalloc.c Outdated Show resolved Hide resolved
src/unit/test_zmalloc.c Outdated Show resolved Hide resolved
src/unit/test_zmalloc.c Outdated Show resolved Hide resolved
src/unit/test_zmalloc.c Outdated Show resolved Hide resolved
src/unit/test_zmalloc.c Outdated Show resolved Hide resolved
src/unit/test_zmalloc.c Outdated Show resolved Hide resolved
src/unit/test_zmalloc.c Outdated Show resolved Hide resolved
src/unit/test_zmalloc.c Outdated Show resolved Hide resolved
karthyuom and others added 25 commits May 13, 2024 12:46
Despite the fact that SO_REUSEADDR can be set on a Unix domain socket
via setsockopt() without reporting an error, SO_REUSEADDR was actually
created for ipv4/ipv6 and it's not supported for sockets of AF_UNIX.

Therefore, setting this option on a Unix domain socket does nothing but
costs one extra system call.

Signed-off-by: Andy Pan <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
This PR migrates all tests related to util into new test framework as
part of the parent issue valkey-io#428.

---------

Signed-off-by: Karthick Ariyaratnam <[email protected]>

Signed-off-by: Karthick Ariyaratnam <[email protected]>
Updated redis instances accordingly as follows.
rediscmd -> serverCmd
freeRedisModuleAsyncRMCallPromise -> freeValkeyModuleAsyncRMCallPromise
MyCommand_RedisCommand -> MyCommand_ValkeyCommand
RedisModuleString -> ValkeyModuleString
flushRedisModuleIOBuffer -> flushValkeyModuleIOBuffer

Signed-off-by: Shivshankar-Reddy <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
This PR migrates all tests related to kvstore into new test framework as
part of the parent issue valkey-io#428.

---------

Signed-off-by: Karthick Ariyaratnam <[email protected]>
Signed-off-by: Madelyn Olson <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>

Signed-off-by: Karthick Ariyaratnam <[email protected]>
Updated valkey in follwing functions.

genRedisInfoString -> genValkeyInfoString
genRedisInfoStringCommandStats -> genValkeyInfoStringCommandStats
genRedisInfoStringACLStats -> genValkeyInfoStringACLStats
genRedisInfoStringLatencyStats -> genValkeyInfoStringLatencyStats

Signed-off-by: Shivshankar-Reddy <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Fix the compile error with the following command:
`make all-with-unit-tests SERVER_CFLAGS='-Werror -DSERVER_TEST'
`

```
/usr/bin/ld: /home/ubuntu/valkey-shiv-repo/valkey/src/eval.c:1172: undefined reference to `lua_next'
/usr/bin/ld: /home/ubuntu/valkey-shiv-repo/valkey/src/eval.c:1154: undefined reference to `lua_toboolean'
/usr/bin/ld: /home/ubuntu/valkey-shiv-repo/valkey/src/eval.c:1175: undefined reference to `lua_type'
/usr/bin/ld: /home/ubuntu/valkey-shiv-repo/valkey/src/eval.c:1176: undefined reference to `lua_tonumber'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:469: valkey-unit-tests] Error 1
make[1]: Leaving directory '/home/ubuntu/valkey-shiv-repo/valkey/src'
make: *** [Makefile:6: all-with-unit-tests] Error 2
```

Issue is happened as all deps libraries not linked for
valkey-unit-tests, so linked all libraries to the binary.

Signed-off-by: Shivshankar-Reddy <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
This is a preparation for adding clang-format.

These comments prevent automatic formatting in some places. With these
exceptions, we will be able to run clang-format on the rest of the code.

This is a preparation for valkey-io#323.

---------

Signed-off-by: Viktor Söderqvist <[email protected]>

Signed-off-by: Karthick Ariyaratnam <[email protected]>
…fig. (valkey-io#415)

Updated serverPanic output in db.c based on the
extended-redis-compatibility config. and also updated comments in other
files.

---------

Signed-off-by: Shivshankar-Reddy <[email protected]>

Signed-off-by: Karthick Ariyaratnam <[email protected]>
All the intset unit tests are migrated to new test framework as part of
valkey-io#344, but the old framework
declaration is missed to remove from intset.h. So removed the code.

Signed-off-by: Shivshankar-Reddy <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
We currently has two disjoint TCL frameworks:
1. Normal testing framework, which trigger by runtest, which individually
launches nodes for testing.
2. Cluster framework, which trigger by runtest-cluster, which pre-allocates
N nodes and uses them for testing large configurations.

The normal TCL testing framework is much more readily tested and is also
automatically run as part of the CI for new PRs. The runtest-cluster since
it runs very slowly (cannot be parallelized), it currently only runs in daily
CI, this results in some changes to the cluster not being exposed in PR CI
in time.

This PR migrate the Cluster mode tests to normal framework. Some cluster
tests are kept in runtest-cluster because of timing issues or not yet
supported, we can process them later.

Signed-off-by: Binbin <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
This is a follow-up PR to address UNUSED repetition issue (see
valkey-io#446 (comment)) in
different test source files.

Signed-off-by: Karthick Ariyaratnam <[email protected]>
* `freeClientArgv` was previously defined in `server.h`
* remove the redundant return

Signed-off-by: arthur.lee <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Move dependency from `slowlog.c` into `slowlog.h`, make sure the
language server can work properly under `slowlog.h`

Signed-off-by: arthur.lee <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
This patch migrates all tests in sds.c into new test framework as part
of the parent issue valkey-io#428.

---------

Signed-off-by: Lipeng Zhu <[email protected]>
Signed-off-by: Madelyn Olson <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>

Signed-off-by: Karthick Ariyaratnam <[email protected]>
Before this PR, `pipe2()` is only enabled on Linux and FreeBSD while
`pipe2()` is available on *BSD.

This PR enables `pipe2()` for the rest of *BSD: DragonFlyBSD, NetBSD and
OpenBSD.

## References

- [pipe2 on
DraonFlyBSD](https://man.dragonflybsd.org/?command=pipe&section=2)
- [__DragonFly_version for
pipe2](https://github.com/DragonFlyBSD/DragonFlyBSD/blob/7485684fa5c3fadb6c7a1da0d8bb6ea5da4e0f2f/sys/sys/param.h#L121)
- [pipe2 on  NetBSD](https://man.netbsd.org/pipe.2)
- [pipe2 on OpenBSD](https://man.openbsd.org/pipe.2)

Signed-off-by: Andy Pan <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
…t slot away with allow-replica-migration enabled (valkey-io#466)

Signed-off-by: Karthick Ariyaratnam <[email protected]>
This migrates unit tests related to sha1 to new framework, ref: valkey-io#428.

---------

Signed-off-by: Shivshankar-Reddy <[email protected]>
Signed-off-by: Madelyn Olson <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>

Signed-off-by: Karthick Ariyaratnam <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
karthyuom and others added 6 commits May 13, 2024 12:49
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
Signed-off-by: Karthick Ariyaratnam <[email protected]>
@karthyuom
Copy link
Contributor Author

Please refer the PR #493.

@karthyuom karthyuom closed this May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants