#!/bin/bash # $HeadURL$ $LastChangedRevision$ # There is no point in running this test with REQUIRED_CPUS set to 1. REQUIRED_CPUS=2 # Note this error message is sent to the terminal as it is imperative the user understands the failure. These # checks are duplicated in testlist. [ $(id -u) = 0 ] || { echo "${0##*/}: this test can only pass when run as root" >/dev/tty; exit 1; } (( $(lscpu | sed -rn 's/^CPU\(s\): *//p') >= $REQUIRED_CPUS )) || { echo "${0##*/}: this test can only pass when run on a system with at least $REQUIRED_CPUS CPUs" >/dev/tty; exit 1; } echo "setting up environment ..." export JS_NAME=$(tr -dc A-Za-z0-9 /dev/null | cut -d/ -f3 | while read PID; do FILTER2=$(strings /proc/$PID/environ 2>/dev/null | sed -n -r 's/^FILTER2=([0-9]*).*/\1/p') CPU=$(cut -d' ' -f39 /proc/$PID/stat 2>/dev/null) if [ "X$FILTER2" = X ] || [ "X$CPU" = X ]; then continue fi echo "$FILTER2 $CPU" done | sort | uniq -c | sort -n | while read COUNT FILTER2 CPU; do echo "CPU $CPU has $COUNT pids related to one particular job on it" done | sort # That should output the value of $REQUIRED_CPUS - i.e. each of the $REQUIRED_CPUS group of ~10 pids # should be running on a single and different CPU. echo "waiting for jobs to complete ..." wait_for_jobs echo "cleaning up ..." jsc quit wait $JSD_PID echo "all done"