From 0998eef5569c89c58900749abeb2696dea93b9bf Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Fri, 6 Sep 2024 07:20:18 -0700 Subject: [PATCH] files deleted in previous cherry-pick but not merged correctly --- exe_go118.go | 48 -------- .../windows/registry/zsyscall_windows.go | 111 ------------------ internal/textutil/diff_test.go | 45 ------- 3 files changed, 204 deletions(-) delete mode 100644 exe_go118.go delete mode 100644 internal/syscall/windows/registry/zsyscall_windows.go delete mode 100644 internal/textutil/diff_test.go diff --git a/exe_go118.go b/exe_go118.go deleted file mode 100644 index a9bdd810..00000000 --- a/exe_go118.go +++ /dev/null @@ -1,48 +0,0 @@ -package testscript - -import ( - "reflect" - "testing" - "time" -) - -func mainStart() *testing.M { - // Note: testing.MainStart acquired an extra argument in Go 1.18. - return testing.MainStart(nopTestDeps{}, nil, nil, nil, nil) -} - -// Note: corpusEntry is an anonymous struct type used by some method stubs. -type corpusEntry = struct { - Parent string - Path string - Data []byte - Values []interface{} - Generation int - IsSeed bool -} - -// Note: CoordinateFuzzing was added in Go 1.18. -func (nopTestDeps) CoordinateFuzzing(time.Duration, int64, time.Duration, int64, int, []corpusEntry, []reflect.Type, string, string) error { - return nil -} - -// Note: RunFuzzWorker was added in Go 1.18. -func (nopTestDeps) RunFuzzWorker(func(corpusEntry) error) error { - return nil -} - -// Note: ReadCorpus was added in Go 1.18. -func (nopTestDeps) ReadCorpus(string, []reflect.Type) ([]corpusEntry, error) { - return nil, nil -} - -// Note: CheckCorpus was added in Go 1.18. -func (nopTestDeps) CheckCorpus([]interface{}, []reflect.Type) error { - return nil -} - -// Note: ResetCoverage was added in Go 1.18. -func (nopTestDeps) ResetCoverage() {} - -// Note: SnapshotCoverage was added in Go 1.18. -func (nopTestDeps) SnapshotCoverage() {} diff --git a/internal/syscall/windows/registry/zsyscall_windows.go b/internal/syscall/windows/registry/zsyscall_windows.go deleted file mode 100644 index 04f54d55..00000000 --- a/internal/syscall/windows/registry/zsyscall_windows.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by 'go generate'; DO NOT EDIT. - -package registry - -import ( - "syscall" - "unsafe" - - "fortio.org/testscript/internal/syscall/windows/sysdll" -) - -var _ unsafe.Pointer - -// Do the interface allocations only once for common -// Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - -var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) -) - -// errnoErr returns common boxed Errno values, to prevent -// allocations at runtime. -func errnoErr(e syscall.Errno) error { - switch e { - case 0: - return nil - case errnoERROR_IO_PENDING: - return errERROR_IO_PENDING - } - // TODO: add more here, after collecting data on the common - // error values see on Windows. (perhaps when running - // all.bat?) - return e -} - -var ( - modadvapi32 = syscall.NewLazyDLL(sysdll.Add("advapi32.dll")) - modkernel32 = syscall.NewLazyDLL(sysdll.Add("kernel32.dll")) - - procRegCreateKeyExW = modadvapi32.NewProc("RegCreateKeyExW") - procRegDeleteKeyW = modadvapi32.NewProc("RegDeleteKeyW") - procRegSetValueExW = modadvapi32.NewProc("RegSetValueExW") - procRegEnumValueW = modadvapi32.NewProc("RegEnumValueW") - procRegDeleteValueW = modadvapi32.NewProc("RegDeleteValueW") - procRegLoadMUIStringW = modadvapi32.NewProc("RegLoadMUIStringW") - procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW") -) - -func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) { - r0, _, _ := syscall.Syscall9(procRegCreateKeyExW.Addr(), 9, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition))) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) { - r0, _, _ := syscall.Syscall(procRegDeleteKeyW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(subkey)), 0) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) { - r0, _, _ := syscall.Syscall6(procRegSetValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize)) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { - r0, _, _ := syscall.Syscall9(procRegEnumValueW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)), 0) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) { - r0, _, _ := syscall.Syscall(procRegDeleteValueW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(name)), 0) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint32, buflenCopied *uint32, flags uint32, dir *uint16) (regerrno error) { - r0, _, _ := syscall.Syscall9(procRegLoadMUIStringW.Addr(), 7, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(unsafe.Pointer(buflenCopied)), uintptr(flags), uintptr(unsafe.Pointer(dir)), 0, 0) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} diff --git a/internal/textutil/diff_test.go b/internal/textutil/diff_test.go deleted file mode 100644 index 4d61f8fe..00000000 --- a/internal/textutil/diff_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2018 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 textutil_test - -import ( - "strings" - "testing" - - "fortio.org/testscript/internal/textutil" -) - -var diffTests = []struct { - text1 string - text2 string - diff string -}{ - {"a b c", "a b d e f", "a b -c +d +e +f"}, - {"", "a b c", "+a +b +c"}, - {"a b c", "", "-a -b -c"}, - {"a b c", "d e f", "-a -b -c +d +e +f"}, - {"a b c d e f", "a b d e f", "a b -c d e f"}, - {"a b c e f", "a b c d e f", "a b c +d e f"}, -} - -func TestDiff(t *testing.T) { - for _, tt := range diffTests { - // Turn spaces into \n. - text1 := strings.Replace(tt.text1, " ", "\n", -1) - if text1 != "" { - text1 += "\n" - } - text2 := strings.Replace(tt.text2, " ", "\n", -1) - if text2 != "" { - text2 += "\n" - } - out := textutil.Diff(text1, text2) - // Cut final \n, cut spaces, turn remaining \n into spaces. - out = strings.Replace(strings.Replace(strings.TrimSuffix(out, "\n"), " ", "", -1), "\n", " ", -1) - if out != tt.diff { - t.Errorf("diff(%q, %q) = %q, want %q", text1, text2, out, tt.diff) - } - } -}