// Copyright (C) 2014 The Syncthing Authors. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at https://mozilla.org/MPL/2.0/. //go:build integration && benchmark // +build integration,benchmark package integration import ( "log" "math/rand" "os" "testing" "time" "github.com/syncthing/syncthing/lib/rc" ) func TestBenchmarkTransferManyFiles(t *testing.T) { setupAndBenchmarkTransfer(t, 10000, 15) } func TestBenchmarkTransferLargeFile1G(t *testing.T) { setupAndBenchmarkTransfer(t, 1, 30) } func TestBenchmarkTransferLargeFile2G(t *testing.T) { setupAndBenchmarkTransfer(t, 1, 31) } func TestBenchmarkTransferLargeFile4G(t *testing.T) { setupAndBenchmarkTransfer(t, 1, 32) } func TestBenchmarkTransferLargeFile8G(t *testing.T) { setupAndBenchmarkTransfer(t, 1, 33) } func TestBenchmarkTransferLargeFile16G(t *testing.T) { setupAndBenchmarkTransfer(t, 1, 34) } func TestBenchmarkTransferLargeFile32G(t *testing.T) { setupAndBenchmarkTransfer(t, 1, 35) } func setupAndBenchmarkTransfer(t *testing.T, files, sizeExp int) { cleanBenchmarkTransfer(t) log.Println("Generating files...") var err error if files == 1 { // Special case. Generate one file with the specified size exactly. var fd *os.File fd, err = os.Open("../LICENSE") if err != nil { t.Fatal(err) } err = os.MkdirAll("s1", 0755) if err != nil { t.Fatal(err) } err = generateOneFile(fd, "s1/onefile", 1<