Linux vmi284606.contaboserver.net 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.57 (Ubuntu)
: 167.86.127.34 | : 216.73.217.31
Cant Read [ /etc/named.conf ]
7.2.24-0ubuntu0.18.04.17
root
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
local /
go /
src /
runtime /
pprof /
[ HOME SHELL ]
Name
Size
Permission
Action
internal
[ DIR ]
drwxr-xr-x
testdata
[ DIR ]
drwxr-xr-x
elf.go
2.79
KB
-rw-r--r--
label.go
2.55
KB
-rw-r--r--
label_test.go
2.53
KB
-rw-r--r--
map.go
1.94
KB
-rw-r--r--
mprof_test.go
5.35
KB
-rw-r--r--
pprof.go
27.24
KB
-rw-r--r--
pprof_test.go
34.46
KB
-rw-r--r--
proto.go
22.63
KB
-rw-r--r--
proto_test.go
16.25
KB
-rw-r--r--
protobuf.go
2.51
KB
-rw-r--r--
protomem.go
2.91
KB
-rw-r--r--
protomem_test.go
2.54
KB
-rw-r--r--
runtime.go
1.5
KB
-rw-r--r--
runtime_test.go
3
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : label_test.go
package pprof import ( "context" "reflect" "sort" "testing" ) func labelsSorted(ctx context.Context) []label { ls := []label{} ForLabels(ctx, func(key, value string) bool { ls = append(ls, label{key, value}) return true }) sort.Sort(labelSorter(ls)) return ls } type labelSorter []label func (s labelSorter) Len() int { return len(s) } func (s labelSorter) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s labelSorter) Less(i, j int) bool { return s[i].key < s[j].key } func TestContextLabels(t *testing.T) { // Background context starts with no labels. ctx := context.Background() labels := labelsSorted(ctx) if len(labels) != 0 { t.Errorf("labels on background context: want [], got %v ", labels) } // Add a single label. ctx = WithLabels(ctx, Labels("key", "value")) // Retrieve it with Label. v, ok := Label(ctx, "key") if !ok || v != "value" { t.Errorf(`Label(ctx, "key"): got %v, %v; want "value", ok`, v, ok) } gotLabels := labelsSorted(ctx) wantLabels := []label{{"key", "value"}} if !reflect.DeepEqual(gotLabels, wantLabels) { t.Errorf("(sorted) labels on context: got %v, want %v", gotLabels, wantLabels) } // Add a label with a different key. ctx = WithLabels(ctx, Labels("key2", "value2")) v, ok = Label(ctx, "key2") if !ok || v != "value2" { t.Errorf(`Label(ctx, "key2"): got %v, %v; want "value2", ok`, v, ok) } gotLabels = labelsSorted(ctx) wantLabels = []label{{"key", "value"}, {"key2", "value2"}} if !reflect.DeepEqual(gotLabels, wantLabels) { t.Errorf("(sorted) labels on context: got %v, want %v", gotLabels, wantLabels) } // Add label with first key to test label replacement. ctx = WithLabels(ctx, Labels("key", "value3")) v, ok = Label(ctx, "key") if !ok || v != "value3" { t.Errorf(`Label(ctx, "key3"): got %v, %v; want "value3", ok`, v, ok) } gotLabels = labelsSorted(ctx) wantLabels = []label{{"key", "value3"}, {"key2", "value2"}} if !reflect.DeepEqual(gotLabels, wantLabels) { t.Errorf("(sorted) labels on context: got %v, want %v", gotLabels, wantLabels) } // Labels called with two labels with the same key should pick the second. ctx = WithLabels(ctx, Labels("key4", "value4a", "key4", "value4b")) v, ok = Label(ctx, "key4") if !ok || v != "value4b" { t.Errorf(`Label(ctx, "key4"): got %v, %v; want "value4b", ok`, v, ok) } gotLabels = labelsSorted(ctx) wantLabels = []label{{"key", "value3"}, {"key2", "value2"}, {"key4", "value4b"}} if !reflect.DeepEqual(gotLabels, wantLabels) { t.Errorf("(sorted) labels on context: got %v, want %v", gotLabels, wantLabels) } }
Close