-
Notifications
You must be signed in to change notification settings - Fork 4.1k
roachtest: simplify bootstrapping of native libs #81081
Description
Currently, roachtests are responsible for explicitly staging libgeos (plus any other native libs needed by future tests). E.g., roachtests which need libgeos execute the following before starting a cluster,
if err := c.PutE(ctx, t.L(), t.Cockroach(), "./cockroach"); err != nil {
t.Fatal(err)
}
if err := c.PutLibraries(ctx, "./lib"); err != nil {
t.Fatalf("could not initialize libraries: %v", err)
}
The first statement stages the currently executing binary. The second statement stages libgeos and libgeos_c; these libs are linked dynamically during crdb node startup (see initGEOS). Note that roachtest initializes (see initBinariesAndLibraries) libraryFilePaths with the (local) paths of all the supported native libs (libgeos and libgeos_c at this time) found on the machine executing roachtest (see findLibrary).
Per above, roachtest is already aware of present native libs. Hence, PutLibraries appears redundant. Furthermore, it's yet another detail the test writer has to remember. Thirdly, without reading the test code, there isn't an easy way to see which tests require the use of native libs. Lifting this into TestSpec accomplishes all of the above. E.g.,
type TestSpec struct {
...
NativeLibs []string
}
During Run, TestSpec is verified wrt NativeLibs; if the specified libs cannot be found, then the test is aborted. Otherwise, we use libraryFilePaths in conjunction with ClusterSpec to provision a cluster and stage the native libs.
Jira issue: CRDB-15365