Skip to content

Instantly share code, notes, and snippets.

@Hajto
Created January 17, 2018 10:08
Show Gist options
  • Save Hajto/6ac2cc508108939de81ab079d7761f86 to your computer and use it in GitHub Desktop.
Save Hajto/6ac2cc508108939de81ab079d7761f86 to your computer and use it in GitHub Desktop.
PROD?=5
CON?=3
help:
@echo "To set number of producers user PROD env and user CON for consumer count"
run-test-unnamed:
echo $(PROD)
echo "Dopuszczalna różnica jednego znaku na plik źródłowy (\n na zakończenie), liczba plików źródłowych:"
ls cmake-build-debug/producer_src | wc -l
make cleanup
./gen_n_test_files.sh $(PROD) 1
make run $2
make test
run:
(cd cmake-build-debug && ./unnamed_pipe $(CON))
gen_prod:
./gen_n_test_files.sh $(PROD) 1
cleanup:
rm cmake-build-debug/consumer_out/* || true
rm cmake-build-debug/producer_src/* || true
test:
echo "Producer char count"
cat cmake-build-debug/producer_src/* | wc -c
echo "Consumer char count"
cat cmake-build-debug/consumer_out/* | wc -c
create-test-users:
id -u producer || sudo useradd producer -p password
id -u consumer || sudo useradd consumer -p password
getent group || sudo groupadd pipy
sudo adduser producer pipy || true
sudo adduser consumer pipy || true
run-producer:
echo "Pierwszy argument prod to src_plik, drugi to pipe_name"
sudo su -l producer -c whoami
sudo su -l producer --preserve-environment -c pwd && cmake-build-debug/named_producer cmake-build-debug/laba cmake-build-debug/somepipe
run-consumer:
echo "Pierwszy argument consumer to src_plik, drugi to pipe_name"
sudo su -l consumer -c whoami
sudo su -l consumer --preserve-environment -c pwd && cmake-build-debug/named_consumer cmake-build-debug/laba-named-result cmake-build-debug/somepipe
test-named:
(diff cmake-build-debug/laba cmake-build-debug/laba-named-result && echo "Wynik poprawny") || echo "Wynik niepoprawny"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment