tailscale/tstest/integration/vms/gen/test_codegen.go
Will Norris 71029cea2d all: update copyright and license headers
This updates all source files to use a new standard header for copyright
and license declaration.  Notably, copyright no longer includes a date,
and we now use the standard SPDX-License-Identifier header.

This commit was done almost entirely mechanically with perl, and then
some minimal manual fixes.

Updates #6865

Signed-off-by: Will Norris <will@tailscale.com>
2023-01-27 15:36:29 -08:00

55 lines
1.3 KiB
Go

// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
// build ignore
package main
import (
_ "embed"
"fmt"
"log"
"os"
"time"
"github.com/dave/jennifer/jen"
"github.com/iancoleman/strcase"
"tailscale.com/tstest/integration/vms"
)
func main() {
f := jen.NewFile("vms")
f.Comment("Code generated by tstest/integration/vms/gen/test_codegen.go DO NOT EDIT.")
ptr := jen.Op("*")
for i, d := range vms.Distros {
f.Func().
Id("TestRun" + strcase.ToCamel(d.Name)).
Params(jen.Id("t").Add(ptr).Qual("testing", "T")).
BlockFunc(func(g *jen.Group) {
g.Id("t").Dot("Parallel").Call()
g.Id("setupTests").Call(jen.Id("t"))
g.Id("testOneDistribution").Call(jen.Id("t"), jen.Lit(i), jen.Id("Distros").Index(jen.Lit(i)))
})
}
os.Remove("top_level_test.go")
fout, err := os.Create("top_level_test.go")
if err != nil {
log.Fatal(err)
}
defer fout.Close()
fmt.Fprintf(fout, "// Copyright (c) %d Tailscale Inc & AUTHORS All rights reserved.\n", time.Now().Year())
fout.WriteString("// Use of this source code is governed by a BSD-style\n")
fout.WriteString("// license that can be found in the LICENSE file.\n")
fout.WriteString("\n")
fout.WriteString("// +build linux\n\n")
err = f.Render(fout)
if err != nil {
log.Fatal(err)
}
}