From 834169842ca0dbadcfcffbf0cce9ab71b487005e Mon Sep 17 00:00:00 2001 From: Raghuveer Devulapalli Date: Tue, 4 Feb 2025 12:56:00 -0800 Subject: [PATCH v3 1/4] Add more test coverage for crc32c --- src/test/regress/expected/crc32c.out | 42 ++++++++++++++++++++++++++++ src/test/regress/parallel_schedule | 2 ++ src/test/regress/sql/crc32c.sql | 12 ++++++++ 3 files changed, 56 insertions(+) create mode 100644 src/test/regress/expected/crc32c.out create mode 100644 src/test/regress/sql/crc32c.sql diff --git a/src/test/regress/expected/crc32c.out b/src/test/regress/expected/crc32c.out new file mode 100644 index 0000000000..f25965df4a --- /dev/null +++ b/src/test/regress/expected/crc32c.out @@ -0,0 +1,42 @@ +-- +-- CRC32C +-- Testing CRC32C SSE4.2 algorithm. +-- The new algorithm has various code paths that needs test coverage. +-- We achieve that by computing CRC32C of text of various sizes: 15, 64, 128, 144, 159 and 256 bytes. +-- +SELECT crc32c(''); + crc32c +-------- + 0 +(1 row) + +SELECT crc32c('Hello 15 bytes!'); + crc32c +------------ + 3405757121 +(1 row) + +SELECT crc32c('This is a 64 byte piece of text to run through the main loop ...'); + crc32c +----------- + 721494841 +(1 row) + +SELECT crc32c('This is a carefully constructed text that needs to be exactly 128 bytes long for testing purposes. Let me add more words to ....'); + crc32c +------------ + 1602016964 +(1 row) + +SELECT crc32c('This is a text that needs to be exactly 144 bytes long for testing purposes. I will add more words to reach that specific length. Now we are ...'); + crc32c +------------ + 1912862944 +(1 row) + +SELECT crc32c('This is a precisely crafted message that needs to be exactly 159 bytes in length for testing purposes. I will continue adding more text until we reach that ...'); + crc32c +------------ + 1245879782 +(1 row) + diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule index e63ee2cf2b..73a84e6def 100644 --- a/src/test/regress/parallel_schedule +++ b/src/test/regress/parallel_schedule @@ -56,6 +56,8 @@ test: create_aggregate create_function_sql create_cast constraints triggers sele # ---------- test: sanity_check +test: crc32c + # ---------- # Another group of parallel tests # aggregates depends on create_aggregate diff --git a/src/test/regress/sql/crc32c.sql b/src/test/regress/sql/crc32c.sql new file mode 100644 index 0000000000..5e481eab6f --- /dev/null +++ b/src/test/regress/sql/crc32c.sql @@ -0,0 +1,12 @@ +-- +-- CRC32C +-- Testing CRC32C SSE4.2 algorithm. +-- The new algorithm has various code paths that needs test coverage. +-- We achieve that by computing CRC32C of text of various sizes: 15, 64, 128, 144, 159 and 256 bytes. +-- +SELECT crc32c(''); +SELECT crc32c('Hello 15 bytes!'); +SELECT crc32c('This is a 64 byte piece of text to run through the main loop ...'); +SELECT crc32c('This is a carefully constructed text that needs to be exactly 128 bytes long for testing purposes. Let me add more words to ....'); +SELECT crc32c('This is a text that needs to be exactly 144 bytes long for testing purposes. I will add more words to reach that specific length. Now we are ...'); +SELECT crc32c('This is a precisely crafted message that needs to be exactly 159 bytes in length for testing purposes. I will continue adding more text until we reach that ...'); -- 2.43.0