Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merges fuzztool into envtool #2645

Merged
merged 8 commits into from Jul 19, 2023
Merged

Merges fuzztool into envtool #2645

merged 8 commits into from Jul 19, 2023

Conversation

Aditya1404Sal
Copy link
Contributor

Description

Closes #2547 .

Readiness checklist

  • I added/updated unit tests.
  • I added/updated integration/compatibility tests.
  • I added/updated comments and checked rendering.
  • I made spot refactorings.
  • I updated user documentation.
  • I ran task all, and it passed.
  • I ensured that PR title is good enough for the changelog.
  • (for maintainers only) I set Reviewers (@FerretDB/core), Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@CLAassistant
Copy link

CLAassistant commented May 16, 2023

CLA assistant check
All committers have signed the CLA.

@AlekSi AlekSi added this to the Next milestone May 19, 2023
@AlekSi AlekSi added the code/chore Code maintenance improvements label May 19, 2023
Copy link
Member

@rumyantseva rumyantseva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Aditya1404Sal, thank you very much for your contribution!

The main objective of the task is to incorporate a new subcommand called fuzz corpus to envtool. So it can be called as envtool fuzz corpus.

In the current implementation, there is a conflict between the files fuzzcorpus.go and envtool.go due to the presence of variables with identical names. Instead of this conflict, we can modify the implementation to utilize the cli already defined in envtool.go. For instance, the existing cli includes subcommands like shell mkdir or shell read. We can extend it further to incorporate fuzz corpus in a similar fashion.

I appreciate that you've implemented this command in a separate file called fuzzcorpus.go, and we can continue to keep it there. However, we don't need a separate cli definition in that file.

@AlekSi AlekSi modified the milestones: v1.2.0, Next May 22, 2023
@Aditya1404Sal
Copy link
Contributor Author

@rumyantseva
I'm really really grateful for your clarification and explanation
i will try to resolve this issue as soon as possible.
however i have University exams in 4 days is it fine if it takes longer for me to resolve this bug ?

@rumyantseva
Copy link
Member

@Aditya1404Sal no worries, please take your time, we can wait! And good luck with the exams! 🤞

@Aditya1404Sal Aditya1404Sal marked this pull request as ready for review June 5, 2023 05:54
@Aditya1404Sal Aditya1404Sal requested review from a team and AlekSi as code owners June 5, 2023 05:54
@AlekSi AlekSi requested review from rumyantseva and removed request for w84thesun June 5, 2023 08:39
@AlekSi AlekSi modified the milestones: v1.3.0, Next Jun 5, 2023
Copy link
Member

@AlekSi AlekSi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run task fuzz-corpus locally. You will see that it does not compile

@Aditya1404Sal
Copy link
Contributor Author

Aditya1404Sal commented Jun 11, 2023

@AlekSi , i managed to resolve the compilation errors for bin/task fuzz-corpus but , i am unable to get past this error

it seems that the error originates from a failure in running the "git describe --dirty" command and the absence of a variate in package.txt.

However i haven't made any changes to the build files.

Please provide me assistance on resolving this error

4s
2s
48s
49s
0s
Run bin/task init
task: [init-integration] go mod tidy
task: [gen-version] go generate -x ./build/version
task: [init-tools] go mod tidy
task: [init-tools-golangci] go mod tidy
go run ./generate.go
task: [init-integration] go mod verify
task: [init-tools-golangci] go mod verify
task: [init-tools] go mod verify
package.txt: 
branch.txt: main
fatal: No names found, cannot describe anything.
panic: Failed to run "git describe --dirty": exit status 128

goroutine 18 [running]:
main.runGit({0xc00003a7a8?, 0x0?, 0x0?})
	/home/runner/work/FerretDB/FerretDB/build/version/generate.go:37 +0x11b
main.main.func1()
	/home/runner/work/FerretDB/FerretDB/build/version/generate.go:59 +0x9b
created by main.main
	/home/runner/work/FerretDB/FerretDB/build/version/generate.go:56 +0x85
exit status 2
build/version/version.go:69: running "go": exit status 1
task: Failed to run task "gen-version": exit status 1
Error: Process completed with exit code 201.```

.github/workflows/go.yml Outdated Show resolved Hide resolved
cmd/envtool/envtool.go Outdated Show resolved Hide resolved
cmd/envtool/envtool.go Outdated Show resolved Hide resolved
@AlekSi
Copy link
Member

AlekSi commented Jun 12, 2023

@Aditya1404Sal Please run commands from https://github.com/FerretDB/FerretDB/blob/main/CONTRIBUTING.md#making-a-working-copy, then run git fetch --all --tags

@mergify
Copy link
Contributor

mergify bot commented Jun 16, 2023

@Aditya1404Sal this pull request has merge conflicts.

@mergify mergify bot added the conflict PRs that have merge conflicts label Jun 16, 2023
@AlekSi AlekSi modified the milestones: v1.4.0, Next Jun 19, 2023
@rumyantseva
Copy link
Member

@Aditya1404Sal please feel free to ping me if you have questions or need some help with the PR.

@Aditya1404Sal
Copy link
Contributor Author

@rumyantseva Thank you ! i really need some help
i can't figure out how to resolve this set-up environment error

2023-06-15T08:44:30.316Z	INFO	envtool/envtool.go:662	Copying from  to .
2023-06-15T08:44:30.316Z	FATAL	envtool/envtool.go:455	[envtool.go:486 main.collectFiles.func1] lstat : no such file or directory
main.copyCorpus
	/home/runner/work/FerretDB/FerretDB/cmd/envtool/envtool.go:455
main.main
	/home/runner/work/FerretDB/FerretDB/cmd/envtool/envtool.go:663
runtime.main
	/opt/hostedtoolcache/go/1.20.5/x64/src/runtime/proc.go:250
exit status 1
task: Failed to run task "env-setup": exit status 1

i've checked the collectFiles & copyCorpus functions but can't find any problems with them
the problem might have something to do with the path variable , but this is speculative.

switch ctx.Command() {
	case "fuzz corpus <src> <dst>":
		switch cli.Fuzz.Corpus.Src {
		case "seed":
			src = seedCorpus
		case "generated":
			src = generatedCorpus
		default:
			src, err = filepath.Abs(cli.Fuzz.Corpus.Src)
			if err != nil {
				logger.Fatal(err)
			}
		}

		switch cli.Fuzz.Corpus.Dst {
		case "seed":
			// Because we would need to add `/testdata/fuzz` back, and that's not very easy.
			logger.Fatal("Copying to seed corpus is not supported.")
		case "generated":
			dst = generatedCorpus
		default:
			dst, err = filepath.Abs(cli.Fuzz.Corpus.Dst)
			if err != nil {
				logger.Fatal(err)
			}
		}
	case "setup":
		err = setup(ctx2, logger)
	case "shell mkdir <path>":
		err = shellMkDir(cli.Shell.Mkdir.Paths...)
	case "shell rmdir <path>":
		err = shellRmDir(cli.Shell.Rmdir.Paths...)
	case "shell read <path>":
		err = shellRead(os.Stdout, cli.Shell.Read.Paths...)
	case "package-version":
		err = packageVersion(os.Stdout, versionFile)
	case "tests shard":
		err = testsShard(os.Stdout, cli.Tests.Shard.Index, cli.Tests.Shard.Total)
	default:
		err = fmt.Errorf("unknown command: %s", ctx.Command())

		if err != nil {
			printDiagnosticData(err, logger)
			os.Exit(1)
		}
	}

I am very sorry for my incompetancy , but i'm really lost about what my next step should be
please provide me with some assistance

@rumyantseva
Copy link
Member

@Aditya1404Sal then let's start by running a stable code. Could you please check out the latest main from the FerretDB repo, init the tooling and run tests through task test-unit (see https://github.com/FerretDB/FerretDB/blob/main/CONTRIBUTING.md for more details)? This way we can understand if your environment is ok. If something doesn't work please post the exact commands your run and the exact responses you get. Feel free to ping me on our community Slack for a faster response.

@Aditya1404Sal Aditya1404Sal requested review from a team and ptrfarkas as code owners June 21, 2023 19:41
@AlekSi AlekSi requested review from chilagrow and noisersup and removed request for ptrfarkas, a team and b1ron July 18, 2023 07:45
AlekSi
AlekSi previously approved these changes Jul 18, 2023
chilagrow
chilagrow previously approved these changes Jul 18, 2023
Copy link
Contributor

@chilagrow chilagrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just super minor comment

cmd/envtool/envtool.go Outdated Show resolved Hide resolved
@AlekSi AlekSi dismissed stale reviews from chilagrow and themself via 0389f46 July 18, 2023 10:44
@AlekSi AlekSi requested review from chilagrow, AlekSi and a team July 18, 2023 10:44
AlekSi
AlekSi previously approved these changes Jul 18, 2023
noisersup
noisersup previously approved these changes Jul 18, 2023
@AlekSi AlekSi changed the title Merges fuzztool into envtool Merges fuzztool into envtool Jul 18, 2023
@AlekSi AlekSi dismissed stale reviews from noisersup and themself via 8e25c35 July 19, 2023 04:34
@AlekSi AlekSi requested review from AlekSi, noisersup and a team July 19, 2023 04:50
Copy link
Contributor

@chilagrow chilagrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Member

@rumyantseva rumyantseva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@AlekSi AlekSi merged commit f4d396e into FerretDB:main Jul 19, 2023
24 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Merge fuzztool into envtool
6 participants