aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Makefile')
-rw-r--r--tests/Makefile17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/Makefile b/tests/Makefile
index b964db5..28a9741 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -7,6 +7,7 @@ BINDIR = bin
NAME_PRELOAD = $(BINDIR)/test_preload
NAME_SHOW = $(BINDIR)/test_show
+NAME_RANDOM = $(BINDIR)/test_random
SRCS = test_preload.c
@@ -24,7 +25,10 @@ $(NAME_SHOW): $(OBJDIR)/test_show.o $(MALLOC_LIB) | $(BINDIR)
$(OBJDIR)/test_show.o: $(SRCDIR)/test_show.c | $(OBJDIR)
$(CC) $(CFLAGS) -I $(MALLOC_INC) -c $< -o $@
-all: $(NAME_PRELOAD) $(NAME_SHOW)
+$(NAME_RANDOM): $(OBJDIR)/test_random.o | $(BINDIR)
+ $(CC) $(CFLAGS) -o $@ $(OBJDIR)/test_random.o
+
+all: $(NAME_PRELOAD) $(NAME_SHOW) $(NAME_RANDOM)
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
@@ -35,7 +39,10 @@ $(OBJDIR):
$(BINDIR):
mkdir -p $(BINDIR)
-test: $(NAME_PRELOAD) $(NAME_SHOW)
+SEED ?= 42
+COUNT ?= 10
+
+test: $(NAME_PRELOAD) $(NAME_SHOW) $(NAME_RANDOM)
@echo "=== system malloc ==="
@$(NAME_PRELOAD)
@echo ""
@@ -44,6 +51,12 @@ test: $(NAME_PRELOAD) $(NAME_SHOW)
@echo ""
@echo "=== show_alloc_mem ==="
@$(NAME_SHOW)
+ @echo ""
+ @echo "=== random (system, seed=$(SEED) count=$(COUNT)) ==="
+ @$(NAME_RANDOM) $(SEED) $(COUNT)
+ @echo ""
+ @echo "=== random (ft_malloc, seed=$(SEED) count=$(COUNT)) ==="
+ @LD_PRELOAD=$(MALLOC_LIB) $(NAME_RANDOM) $(SEED) $(COUNT)
clean:
rm -rf $(OBJDIR) $(BINDIR)