mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-12 17:52:13 +02:00
Update test_webpages.sh
This commit is contained in:
parent
866295ebdb
commit
4a0c6d7b7e
@ -26,7 +26,7 @@ check_webpage() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if response contains HTML
|
# Check if response contains HTML
|
||||||
if ! printf '%s' "$BODY" | grep -q "<!DOCTYPE html>\|<html"; then
|
if ! grep -q "<!DOCTYPE html>\|<html" <<< "$BODY"; then
|
||||||
echo "FAILED - Response is not HTML - $full_url" >> "$result_file"
|
echo "FAILED - Response is not HTML - $full_url" >> "$result_file"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -75,13 +75,13 @@ test_all_urls() {
|
|||||||
|
|
||||||
((total_count++))
|
((total_count++))
|
||||||
((url_index++))
|
((url_index++))
|
||||||
|
|
||||||
# Run the check in background
|
# Run the check in background
|
||||||
test_url "$url" "$base_url" "$tmp_dir" "$url_index" &
|
test_url "$url" "$base_url" "$tmp_dir" "$url_index" &
|
||||||
|
|
||||||
# Track the job
|
# Track the job
|
||||||
((active_jobs++))
|
((active_jobs++))
|
||||||
|
|
||||||
# If we've reached max_parallel, wait for a job to finish
|
# If we've reached max_parallel, wait for a job to finish
|
||||||
if [ $active_jobs -ge $max_parallel ]; then
|
if [ $active_jobs -ge $max_parallel ]; then
|
||||||
wait -n # Wait for any child process to exit
|
wait -n # Wait for any child process to exit
|
||||||
@ -97,7 +97,7 @@ test_all_urls() {
|
|||||||
if [ -f "${tmp_dir}/result_${i}.txt" ]; then
|
if [ -f "${tmp_dir}/result_${i}.txt" ]; then
|
||||||
cat "${tmp_dir}/result_${i}.txt"
|
cat "${tmp_dir}/result_${i}.txt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "${tmp_dir}/failed_${i}" ]; then
|
if [ -f "${tmp_dir}/failed_${i}" ]; then
|
||||||
failed_count=$((failed_count + $(cat "${tmp_dir}/failed_${i}")))
|
failed_count=$((failed_count + $(cat "${tmp_dir}/failed_${i}")))
|
||||||
fi
|
fi
|
||||||
@ -171,4 +171,4 @@ main() {
|
|||||||
# Run main if script is executed directly
|
# Run main if script is executed directly
|
||||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
main "$@"
|
main "$@"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user