<commit_before>#!/bin/bash -e

ROOT=$(readlink -fn $(dirname $0))
MODULE_PATH="${ROOT}/modules:/etc/puppet/modules"

if [ ! -d applytest ] ; then
    mkdir applytest
fi

csplit -sf applytest/puppetapplytest manifests/site.pp '/^$/' {*}
sed -i -e 's/^[^[:space:]]/#&/g' applytest/puppetapplytest*
sed -i -e 's@hiera(.\([^.]*\).,\([^)]*\))@\2@' applytest/puppetapplytest*

set +e
RETURN=0
for f in `find applytest -name 'puppetapplytest*' -print` ; do
    sudo puppet apply --modulepath=${MODULE_PATH} --noop --verbose --debug $f >/dev/null || RETURN=1
done
exit $RETURN
<commit_msg>Use nproc puppet apply processes when testing<commit_after>#!/bin/bash -e

ROOT=$(readlink -fn $(dirname $0))
MODULE_PATH="${ROOT}/modules:/etc/puppet/modules"

if [ ! -d applytest ] ; then
    mkdir applytest
fi

csplit -sf applytest/puppetapplytest manifests/site.pp '/^$/' {*}
sed -i -e 's/^[^[:space:]]/#&/g' applytest/puppetapplytest*
sed -i -e 's@hiera(.\([^.]*\).,\([^)]*\))@\2@' applytest/puppetapplytest*

find applytest -name 'puppetapplytest*' -print0 | xargs -0 -P $(nproc) -n 1 -I filearg sudo puppet apply --modulepath=${MODULE_PATH} --noop --verbose --debug filearg > /dev/null

{'fraction_non_alphanumeric': 0.21635434412265758, 'fraction_numerical': 0.007666098807495741, 'mean_word_length': 3.936974789915966, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2661753', 'n_tokens_mistral': 473, 'n_tokens_neox': 450, 'n_words': 109}