From e31a2fff3b1f3b05ce493e39f7a020e11ef0823c Mon Sep 17 00:00:00 2001 From: AUnicornWithNoLife <55228370+AUnicornWithNoLife@users.noreply.github.com> Date: Thu, 11 May 2023 21:54:43 +0100 Subject: [PATCH] r --- .github/workflows/c.yml | 2 -- .gitignore | 4 +-- makefile | 4 --- stress.sh | 63 ----------------------------------------- 4 files changed, 1 insertion(+), 72 deletions(-) delete mode 100755 stress.sh diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index b45f348..4ba7c5e 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -15,5 +15,3 @@ jobs: - uses: actions/checkout@v3 - name: make test run: make test - - name: make stress - run: make stress diff --git a/.gitignore b/.gitignore index a319eee..a34e165 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,4 @@ dkms.conf test test.elf -test.exe - -stress.log \ No newline at end of file +test.exe \ No newline at end of file diff --git a/makefile b/makefile index 5d33c96..7c27bbd 100644 --- a/makefile +++ b/makefile @@ -2,7 +2,3 @@ test: carg-parse.c carg-parse.h test.c @echo "BUILDING" @clang ./test.c ./carg-parse.c -o ./test @echo "DONE" - -stress: ./test - @echo "STRESSING - if you see any errors / segfaults / fuckups please revert changes or open an issue" - @./stress.sh diff --git a/stress.sh b/stress.sh deleted file mode 100755 index 9fb24e0..0000000 --- a/stress.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# Number of iterations for the stress test -ITERATIONS=100 - -# Executable name -EXECUTABLE="./test" - -# Log file name -LOG_FILE="stress.log" - -# List of possible arguments -ARGUMENTS=( - "-option1" - "-option2" - "-option3" - "-option4" - "-" -) - -# Function to generate a random number within a range -generate_random_number() { - local min=$1 - local max=$2 - echo $((RANDOM % (max - min + 1) + min)) -} - -# Function to generate a random argument combination -generate_random_arguments() { - local arg_count=$(generate_random_number 1 ${#ARGUMENTS[@]}) - local args=() - local used_indexes=() - for (( i = 0; i < arg_count; i++ )); do - local index - while true; do - index=$(generate_random_number 0 $((${#ARGUMENTS[@]} - 1))) - if [[ ! " ${used_indexes[@]} " =~ " ${index} " ]]; then - used_indexes+=($index) - break - fi - done - args+=("${ARGUMENTS[$index]}") - done - echo "${args[@]}" -} - -# Clear the log file -> "$LOG_FILE" - -# Main stress test loop -for (( i = 0; i < ITERATIONS; i++ )); do - arguments=$(generate_random_arguments) - echo "Running test iteration $((i+1)) with arguments: $arguments" - # Add extra quotes to preserve trailing dashes - $EXECUTABLE $arguments - exit_code=$? - if [[ $exit_code -eq 139 ]]; then - echo "Segfault detected!" - echo "Arguments: $arguments" >> "$LOG_FILE" - exit 1 # Exit the script with an error - fi - echo "-----------------------------------------" -done