-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·78 lines (65 loc) · 2.44 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Ensure script exits on error
# NEED DIFFERENCES ACCORIDING TO MACOS AND LINUX
# Set constants
REPORTS_PATH="/home/matthew/final_project/WebGlitchRunner/reports/"
TEMPLATE_PATH="/home/matthew/final_project/WebGlitchFiles/template.js"
export PATH=$PATH
# CONCATENATED_NAME="/Users/matthew/Documents/msc/final_proj/WebGlitchRunner/concatenated.js"
# CHROME_PATH="/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
# FIREFOX_PATH="/Applications/Firefox Nightly.app/Contents/MacOS/firefox"
# PUPPETEER_SCRIPT_PATH="/Users/matthew/Documents/msc/final_proj/WebGlitch/rsrcs/js/puppeteer.js"
export DAWN_DEBUG_BREAK_ON_ERROR=1
backend="" # Initialize the variable to store the backend option
FILEPATH=""
# while getopts "b:o:" opt; do
# case $opt in
# b)
# backend="$OPTARG"
# ;;
# o)
# FILEPATH="$OPTARG"
# ;;
# \?)
# echo "Invalid option: -$OPTARG" >&2
# exit 1
# ;;
# esac
# done
# if [ -z "$backend" ]; then
# echo "Error: WebGPU implementation to run on not provided"
# exit 1
# fi
# if [ -z "$FILEPATH" ]; then
# echo "Error: WebGPU program not specified"
# exit 1
# fi
if [[ "$OSTYPE" == "darwin"* ]]; then
OS_DIR="macos"
INTERCEPTORS="DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/lib/darwin/libclang_rt.asan_osx_dynamic.dylib"
TIMEOUT_CMD="gtimeout"
WGPU_BACKEND="DENO_WEBGPU_BACKEND=metal"
DENO_PATH="/Users/matthew/Documents/msc/final_proj/deno/target/aarch64-apple-darwin/debug/deno"
export MTL_DEBUG_LAYER=1
else
OS_DIR="linux"
INTERCEPTORS="LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/11/libasan.so"
TIMEOUT_CMD="timeout"
WGPU_BACKEND="DENO_WEBGPU_BACKEND=vulkan"
DENO_PATH="/Users/matthew/Documents/msc/final_proj/deno/target/x86_64-unknown-linux-gnu/debug/deno"
export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
fi
# Create reports directory if it does not exist
mkdir -p "${REPORTS_PATH}shaders/${OS_DIR}/"
# Extract filename with extension from FILEPATH
FILENAME=$(basename "$FILEPATH")
# Now extract the number from the filename
# FILENUMBER="${FILENAME%%.*}"
ulimit -c 0
trap "" SIGTRAP
for i in {42..43}; do
echo "Running file $i"
LOG_FILE_NAME="${REPORTS_PATH}shaders/${OS_DIR}/${i}.log"
export SHADER_FILE="$i.wgsl"
LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/11/libasan.so node $TEMPLATE_PATH > "$LOG_FILE_NAME" 2>&1
done