From 441be09a2b967f28320d5ff71e292c6fdd457dc9 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Wed, 25 Oct 2023 12:31:51 +0200 Subject: [PATCH] cmd/geth: move logtest cmd under build-tag --- build/ci.go | 3 +++ cmd/geth/logging_test.go | 2 ++ .../{logtestcmd.go => logtestcmd_active.go} | 11 +++++++++ cmd/geth/logtestcmd_inactive.go | 23 +++++++++++++++++++ cmd/geth/main.go | 4 +++- cmd/geth/misccmd.go | 8 ------- 6 files changed, 42 insertions(+), 9 deletions(-) rename cmd/geth/{logtestcmd.go => logtestcmd_active.go} (96%) create mode 100644 cmd/geth/logtestcmd_inactive.go diff --git a/build/ci.go b/build/ci.go index 1ff3fb5bf8..d081e5505d 100644 --- a/build/ci.go +++ b/build/ci.go @@ -306,6 +306,9 @@ func doTest(cmdline []string) { // Enable CKZG backend in CI. gotest.Args = append(gotest.Args, "-tags=ckzg") + // Enable integration-tests + gotest.Args = append(gotest.Args, "-tags=integrationtests") + // Test a single package at a time. CI builders are slow // and some tests run into timeouts under load. gotest.Args = append(gotest.Args, "-p", "1") diff --git a/cmd/geth/logging_test.go b/cmd/geth/logging_test.go index 1a20f7899b..00e686d83b 100644 --- a/cmd/geth/logging_test.go +++ b/cmd/geth/logging_test.go @@ -1,3 +1,5 @@ +//go:build integrationtests + // Copyright 2023 The go-ethereum Authors // This file is part of go-ethereum. // diff --git a/cmd/geth/logtestcmd.go b/cmd/geth/logtestcmd_active.go similarity index 96% rename from cmd/geth/logtestcmd.go rename to cmd/geth/logtestcmd_active.go index 1a9491354a..c66013517a 100644 --- a/cmd/geth/logtestcmd.go +++ b/cmd/geth/logtestcmd_active.go @@ -1,3 +1,5 @@ +//go:build integrationtests + // Copyright 2023 The go-ethereum Authors // This file is part of go-ethereum. // @@ -28,6 +30,15 @@ import ( "github.com/urfave/cli/v2" ) +var logTestCommand = &cli.Command{ + Action: logTest, + Name: "logtest", + Usage: "Print some log messages", + ArgsUsage: " ", + Description: ` +This command is only meant for testing. +`} + // logTest is an entry point which spits out some logs. This is used by testing // to verify expected outputs func logTest(ctx *cli.Context) error { diff --git a/cmd/geth/logtestcmd_inactive.go b/cmd/geth/logtestcmd_inactive.go new file mode 100644 index 0000000000..691ab5bcd8 --- /dev/null +++ b/cmd/geth/logtestcmd_inactive.go @@ -0,0 +1,23 @@ +//go:build !integrationtests + +// Copyright 2023 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import "github.com/urfave/cli/v2" + +var logTestCommand *cli.Command diff --git a/cmd/geth/main.go b/cmd/geth/main.go index b3b940ca93..2d4fe3dc06 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -233,7 +233,9 @@ func init() { snapshotCommand, // See verkle.go verkleCommand, - logTestCommand, + } + if logTestCommand != nil { + app.Commands = append(app.Commands, logTestCommand) } sort.Sort(cli.CommandsByName(app.Commands)) diff --git a/cmd/geth/misccmd.go b/cmd/geth/misccmd.go index 7ae33f1e7c..f3530c30fb 100644 --- a/cmd/geth/misccmd.go +++ b/cmd/geth/misccmd.go @@ -67,14 +67,6 @@ and displays information about any security vulnerabilities that affect the curr Usage: "Display license information", ArgsUsage: " ", } - logTestCommand = &cli.Command{ - Action: logTest, - Name: "logtest", - Usage: "Print some log messages", - ArgsUsage: " ", - Description: ` -This command is only meant for testing. -`} ) func printVersion(ctx *cli.Context) error {