Parallel Test Runner with Limits

Hard Shell Concurrency Asked at Intel
Solve this problem

Run a directory of test scripts in parallel with a job limit, collect each one's output separately so results do not interleave, and produce a pass/fail summary.

Constraints

  • Concurrency limit passed as the first argument.
  • Each test's stdout and stderr go to its own file.
  • Print a summary with pass and fail counts.
  • Exit code equals the number of failures, capped at 125.
  • Must not leave orphaned background jobs on interrupt.
  • POSIX sh.
Starter codeShell
1#!/bin/sh2# TODO: bounded parallel test runner