Last active
August 26, 2021 21:57
-
-
Save daxmc99/890260959a4067e5c1dced7e2a63ce21 to your computer and use it in GitHub Desktop.
Create a number of perforce text files and add them each as a changelist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -Eeu | |
set -x | |
# You need to use a session ticket (https://about.sourcegraph.com/handbook/support/p4-enablement#generate-a-session-ticket) | |
# in order to avoid password prompts | |
# TO edit this file, you must run `p4 edit create-revision.sh` first | |
suffix="baz" | |
client="dax3" | |
file_size="5000000" # 1,000,000 ~ 1MB | |
big_file_size_bytes="1000000000" # 1 GB | |
start=$(date +%s) | |
for num in {1..1000}; do | |
echo "writing file ${num}" | |
base64 /dev/urandom | head -c ${file_size} > ./test/"${num}_${suffix}".txt | |
if [ $(( num % 10 )) -eq 0 ]; then | |
base64 /dev/urandom | head -c ${big_file_size_bytes} > ./test/"${num}_big_${suffix}".txt | |
fi | |
p4 -c ${client} add test/"${num}_${suffix}".txt | |
p4 -c ${client} submit -d "test-$num" | |
done | |
end=$(date +%s) | |
runtime=$((end-start)) | |
echo "Finished in ${runtime}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment