bryancall commented on code in PR #13257:
URL: https://github.com/apache/trafficserver/pull/13257#discussion_r3398037998


##########
src/iocore/cache/unit_tests/test_RamCacheCLFUS.cc:
##########
@@ -0,0 +1,229 @@
+/** @file
+
+  Catch-based unit tests for RAM cache (CLFUS) compression roundtrips.
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "main.h"
+
+#include "../RamCacheCLFUS.h"
+#include "../P_CacheInternal.h"
+
+#include "iocore/cache/Cache.h"
+#include "tscore/ink_config.h"
+
+#include <cstdint>
+#include <cstring>
+#include <string>
+#include <vector>
+
+// Required by main.h
+int  cache_vols           = 1;
+bool reuse_existing_cache = false;
+
+namespace
+{
+
+// A compression backend to exercise, along with the RAM_HIT_* state get()
+// should report once a compressible object has been stored compressed.
+struct CompressionCase {
+  int         config;       // CACHE_COMPRESSION_*
+  int         expected_hit; // RAM_HIT_COMPRESS_* reported by get() for 
compressible data
+  const char *name;
+};
+
+std::vector<CompressionCase>
+compression_cases()
+{
+  std::vector<CompressionCase> cases{
+    {CACHE_COMPRESSION_NONE,   RAM_HIT_COMPRESS_NONE,   "none"  },
+    {CACHE_COMPRESSION_FASTLZ, RAM_HIT_COMPRESS_FASTLZ, "fastlz"},
+    {CACHE_COMPRESSION_LIBZ,   RAM_HIT_COMPRESS_LIBZ,   "libz"  },
+  };
+#ifdef HAVE_LZMA_H
+  cases.push_back({CACHE_COMPRESSION_LIBLZMA, RAM_HIT_COMPRESS_LIBLZMA, 
"liblzma"});
+#endif
+#ifdef HAVE_LZ4_H
+  cases.push_back({CACHE_COMPRESSION_LZ4, RAM_HIT_COMPRESS_LZ4, "lz4"});
+#endif
+#ifdef HAVE_ZSTD_H
+  cases.push_back({CACHE_COMPRESSION_ZSTD, RAM_HIT_COMPRESS_ZSTD, "zstd"});
+#endif

Review Comment:
   These cases are gated on `HAVE_LZ4_H`/`HAVE_ZSTD_H`, and 
`find_package(LZ4/ZSTD)` is non-`REQUIRED`, so a build without the dev libs (or 
zstd < 1.4.0) skips the lz4/zstd cases and the suite still passes green — i.e. 
the test can't fail for the two backends it was written to protect. The CI 
Dockerfiles do add the libs, but nothing asserts they were actually compiled 
in. A skip-with-`WARN` (or a static check on the CI image) would make a missing 
backend visible in the test output instead of silently reducing coverage.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to