mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-24 18:45:38 -10:00
rmsgpack_read() takes each field from a window the stream lends with the new intfstream_view(), and reads only what the window does not hold. Buffered streams lend their window and file streams lend what filestream_view() lends. The stream is left where the value ends. Reading every entry of a 150,000-entry database through a cursor goes from 1.31 to 1.61 million entries a second, with the same values. The cursor is what the Explore menu and database lookups read through. rmsgpack_window_test writes values of every shape: integers of every width and sign, and strings and binaries up to past the reader's window. It reads them back through buffered streams with 4 KiB and 64-octet windows, a file stream mapped and not, and a memory stream, which lends nothing. Every value must match and the position must be right after each. It passes under ASan and UBSan.
56 lines
1.6 KiB
Makefile
56 lines
1.6 KiB
Makefile
TARGET := rmsgpack_overflow_test
|
|
TARGET2 := rmsgpack_window_test
|
|
|
|
LIBRETRODB_DIR := ../..
|
|
LIBRETRO_COMM_DIR := ../../../libretro-common
|
|
|
|
COMMON := \
|
|
$(LIBRETRODB_DIR)/rmsgpack.c \
|
|
$(LIBRETRODB_DIR)/rmsgpack_dom.c \
|
|
$(LIBRETRO_COMM_DIR)/streams/interface_stream.c \
|
|
$(LIBRETRO_COMM_DIR)/streams/file_stream.c \
|
|
$(LIBRETRO_COMM_DIR)/string/rstrtod.c \
|
|
$(LIBRETRO_COMM_DIR)/streams/memory_stream.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
|
|
$(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \
|
|
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
|
|
$(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.c \
|
|
$(LIBRETRO_COMM_DIR)/features/features_cpu.c \
|
|
$(LIBRETRO_COMM_DIR)/file/file_path.c \
|
|
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
|
|
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
|
|
$(LIBRETRO_COMM_DIR)/time/rtime.c \
|
|
$(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c
|
|
|
|
OBJS := rmsgpack_overflow_test.o $(COMMON:.c=.o)
|
|
OBJS2 := rmsgpack_window_test.o $(COMMON:.c=.o)
|
|
|
|
CFLAGS += -Wall -pedantic -std=gnu99 -g \
|
|
-I$(LIBRETRO_COMM_DIR)/include \
|
|
-I$(LIBRETRODB_DIR)
|
|
LDFLAGS +=
|
|
|
|
# Optional ASan/UBSan build: invoke as 'make SANITIZER=address' or
|
|
# 'make SANITIZER=address,undefined'. Matches the convention used
|
|
# in samples/tasks/http/Makefile.
|
|
ifneq ($(SANITIZER),)
|
|
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer $(CFLAGS)
|
|
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
|
|
endif
|
|
|
|
all: $(TARGET) $(TARGET2)
|
|
|
|
%.o: %.c
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
$(TARGET): $(OBJS)
|
|
$(CC) -o $@ $^ $(LDFLAGS)
|
|
|
|
$(TARGET2): $(OBJS2)
|
|
$(CC) -o $@ $^ $(LDFLAGS)
|
|
|
|
clean:
|
|
rm -f $(TARGET) $(TARGET2) rmsgpack_overflow_test.o rmsgpack_window_test.o $(COMMON:.c=.o)
|
|
|
|
.PHONY: clean
|