added test_alias

expected to fail due to #1013
This commit is contained in:
Yann Collet
2025-06-18 16:25:35 -07:00
parent ee34939dee
commit 2d94529192
4 changed files with 30 additions and 6 deletions

View File

@@ -37,15 +37,11 @@
# elapsed time.
#
# Todos:
# - [ ] Linux: Add native ARM runner.
# - [ ] Linux: Add native ARM64 runner.
# - [ ] Linux: Add native PPC64LE runner.
# - [ ] Linux: Add native S390X runner.
# - [ ] Windows: Add VS2013.
# - [ ] Windows: Add VS2015.
# - [ ] Windows: Add clang for msys2.
# - [ ] Windows: Add native or emulated ARM runner.
# - [ ] Windows: Add native or emulated ARM64 runner.
# - [ ] Windows: Add native or emulated ARM64 runner (note: currently unreliable)
# Name of the workflow is also displayed as a SVG badge
@@ -167,6 +163,11 @@ jobs:
run: |
make clean test-all
- name: test-alias
run: |
make clean
make -C tests test_alias
ubuntu-consistency:
name: Linux x64 check results consistency

1
.gitignore vendored
View File

@@ -21,6 +21,7 @@ dispatch
tests/generate_unicode_test
tests/sanity_test
tests/sanity_test_vectors_generator
tests/test_alias
fuzzer
# Mac OS-X artefacts

View File

@@ -50,7 +50,7 @@ C_SRCDIRS = . .. ../cli
include ../build/make/multiconf.make
.PHONY: all
all: test
all: test test_alias
.PHONY: test
test: test_multiInclude test_unicode test_sanity
@@ -127,6 +127,10 @@ sanity_test_vectors.h: sanity_test_vectors_generator
multiInclude_withxxhash:
$(eval $(call c_program,multiInclude_withxxhash,multiInclude.o xxhash.o))
test_alias: CPPFLAGS += -I..
test_alias: CFLAGS += -O3 -Werror
$(eval $(call c_program,test_alias,test_alias.o))
.PHONY: clean
clean:
@$(RM) *.o

18
tests/test_alias.c Normal file
View File

@@ -0,0 +1,18 @@
#define XXH_INLINE_ALL
#include <inttypes.h>
#include <stdio.h>
#include "xxhash.h"
int main() {
// it seems this has to be exactly 24 bytes.
union {
char x[24];
// force 8-byte alignment without making
// aliasable with uint64_t.
void *y[3];
} data = {.x = "garblegarblegarblegarble"};
uint64_t hash = XXH64(&data, sizeof(data), 0);
printf("%016"PRIx64"\n", hash);
return 0;
}