// 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/. // +build integration,benchmark package integration import ( "log" "os" "runtime" "syscall" "testing" "time" ) func TestBenchmarkTransferManyFiles(t *testing.T) { benchmarkTransfer(t, 50000, 15) } func TestBenchmarkTransferLargeFile1G(t *testing.T) { benchmarkTransfer(t, 1, 30) } func TestBenchmarkTransferLargeFile2G(t *testing.T) { benchmarkTransfer(t, 1, 31) } func TestBenchmarkTransferLargeFile4G(t *testing.T) { benchmarkTransfer(t, 1, 32) } func TestBenchmarkTransferLargeFile8G(t *testing.T) { benchmarkTransfer(t, 1, 33) } func TestBenchmarkTransferLargeFile16G(t *testing.T) { benchmarkTransfer(t, 1, 34) } func TestBenchmarkTransferLargeFile32G(t *testing.T) { benchmarkTransfer(t, 1, 35) } func benchmarkTransfer(t *testing.T, files, sizeExp int) { log.Println("Cleaning...") err := removeAll("s1", "s2", "h1/index*", "h2/index*") if err != nil { t.Fatal(err) } log.Println("Generating files...") 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<