#!/bin/bash

RUN_DATE=`date "+%Y%m%d%H%M"`

# Compile

source ~/dlang/dmd-2.091.1/activate
dmd -w -g -O -J. -debug -gs main.d -ofjson-leak-test
deactivate

# Run under Valgrind

valgrind --leak-check=full \
         --show-leak-kinds=all \
         --track-origins=yes \
         --verbose \
         --log-file=valgrind-out.txt \
         ./json-leak-test

mv valgrind-out.txt valgrind-out-${RUN_DATE}.txt
