#!/bin/bash set -e SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) TEST_DIR="$SCRIPT_DIR/test" rm -rf $TEST_DIR mkdir $TEST_DIR "$SCRIPT_DIR/output/dehydrate.amd64" src $TEST_DIR cat < test/main.cpp #include "_src.hpp" #include #include int main() { // get the current path to this executable std::filesystem::path exepath= std::filesystem::canonical("/proc/self/exe"); recreate_src::recreate_tree(exepath.parent_path().string()+"/temp"); return 0; } EOF g++ -std=c++17 -I $TEST_DIR -o $TEST_DIR/testexe $TEST_DIR/main.cpp $TEST_DIR/_src.cpp echo "----------------------------------------" echo "Should generate all files from src/" $TEST_DIR/testexe # second time should be no changes (hash should match) echo "----------------------------------------" echo "Should be no changes - rerun on same output" $TEST_DIR/testexe # third time just two files changed echo "----------------------------------------" echo "Should see: hash.cpp - updated, and generator.cpp - created." rm $TEST_DIR/temp/generator.cpp echo "whee!" >> $TEST_DIR/temp/hash.cpp $TEST_DIR/testexe