File: threadpool.sh

package info (click to toggle)
cthreadpool 0.0%2Bgit20170424-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 224 kB
  • sloc: ansic: 566; sh: 182; makefile: 16
file content (29 lines) | stat: -rwxr-xr-x 521 bytes parent folder | download | duplicates (3)
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
#! /bin/bash

#
# This file has several functional tests similar to what a user
# might use in his/her code
#

. funcs.sh


function test_mass_addition { #endsum #threads
	echo "Adding up to $1 with $2 threads"
	compile src/conc_increment.c
	output=$(./test $1 $2)
	num=$(echo $output | awk '{print $(NF)}')
	if [ "$num" == "$1" ]; then
		return
	fi
	err "Expected $1 but got $output" "$output"
	exit 1
}


# Run tests
test_mass_addition 100 4
test_mass_addition 100 1000
test_mass_addition 100000 1000

echo "No errors"