-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add testing infra to sysroot creation (#23)
Adds a test harness to help validate sysroot changes before publishing releases. --------- Co-authored-by: Matt Peddie <[email protected]>
- Loading branch information
1 parent
42031f2
commit 9e03c6b
Showing
13 changed files
with
191 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
USE_BAZEL_VERSION=6.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
build:aarch64_sysroot --incompatible_enable_cc_toolchain_resolution | ||
build:aarch64_sysroot --platforms=@rules_swiftnav//platforms:aarch64_bullseye_graviton2 | ||
|
||
build:x86_64_sysroot --incompatible_enable_cc_toolchain_resolution | ||
build:x86_64_sysroot --@rules_swiftnav//cc:enable_sysroot=true | ||
|
||
try-import %workspace%/.bazelrc.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ build-x86/ | |
output/ | ||
llvm-obfuscator-*.txz | ||
sysroot/out | ||
/bazel-* | ||
.bazelrc.user |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
workspace(name = "swift-toolchains") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "bazel_skylib", | ||
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", | ||
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", | ||
], | ||
) | ||
|
||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") | ||
|
||
bazel_skylib_workspace() | ||
|
||
http_archive( | ||
name = "rules_swiftnav", | ||
sha256 = "91a230cf400921189f1654ebe7ca10305e89f3d8cccc0c7486e6fc8886ac0d1b", | ||
strip_prefix = "rules_swiftnav-3262a9ccd01951aa45576be3db102f03b84047eb", | ||
url = "https://github.com/swift-nav/rules_swiftnav/archive/3262a9ccd01951aa45576be3db102f03b84047eb.tar.gz", | ||
) | ||
|
||
load("@rules_swiftnav//cc:repositories.bzl", "register_swift_cc_toolchains", "swift_cc_toolchain") | ||
|
||
swift_cc_toolchain() | ||
|
||
register_swift_cc_toolchains() | ||
|
||
load("@rules_swiftnav//tools:local_archive.bzl", "local_archive") | ||
|
||
local_archive( | ||
name = "aarch64-sysroot", | ||
build_file_content = """ | ||
filegroup( | ||
name = "aarch64-sysroot", | ||
srcs = glob(["*/**"]), | ||
visibility = ["//visibility:public"], | ||
) | ||
""", | ||
src = "//:debian_bullseye_aarch64_sysroot.tar.xz", | ||
) | ||
|
||
local_archive( | ||
name = "x86_64-sysroot", | ||
build_file_content = """ | ||
filegroup( | ||
name = "x86_64-sysroot", | ||
srcs = glob(["*/**"]), | ||
visibility = ["//visibility:public"], | ||
) | ||
""", | ||
src = "//:debian_bullseye_x86_64_sysroot.tar.xz", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
cc_binary( | ||
name = "uuid", | ||
srcs = ["test/uuid.cc"], | ||
linkopts = [ | ||
"-luuid", | ||
], | ||
) | ||
|
||
cc_binary( | ||
name = "foo", | ||
srcs = ["test/lapack.cc"], | ||
linkopts = [ | ||
"-Lexternal/aarch64-sysroot/usr/lib/aarch64-linux-gnu/blas", | ||
"-Lexternal/aarch64-sysroot/usr/lib/aarch64-linux-gnu/lapack", | ||
"-Lexternal/x86_64-sysroot/usr/lib/x86_64-linux-gnu/blas", | ||
"-Lexternal/x86_64-sysroot/usr/lib/x86_64-linux-gnu/lapack", | ||
"-lm", | ||
"-lpthread", | ||
"-lblas", | ||
"-llapack", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// LAPACK test code | ||
//compile with: g++ main.cpp -llapack -lblas -o testprog | ||
|
||
#include <iostream> | ||
#include <vector> | ||
|
||
using namespace std; | ||
|
||
extern "C" void dgetrf_(int* dim1, int* dim2, double* a, int* lda, int* ipiv, int* info); | ||
extern "C" void dgetrs_(char *TRANS, int *N, int *NRHS, double *A, int *LDA, int *IPIV, double *B, int *LDB, int *INFO ); | ||
|
||
int main() | ||
{ | ||
char trans = 'N'; | ||
int dim = 2; | ||
int nrhs = 1; | ||
int LDA = dim; | ||
int LDB = dim; | ||
int info; | ||
|
||
vector<double> a, b; | ||
|
||
a.push_back(1); | ||
a.push_back(1); | ||
a.push_back(1); | ||
a.push_back(-1); | ||
|
||
b.push_back(2); | ||
b.push_back(0); | ||
|
||
int ipiv[3]; | ||
|
||
dgetrf_(&dim, &dim, &*a.begin(), &LDA, ipiv, &info); | ||
dgetrs_(&trans, &dim, &nrhs, & *a.begin(), &LDA, ipiv, & *b.begin(), &LDB, &info); | ||
|
||
|
||
std::cout << "solution is:"; | ||
std::cout << "[" << b[0] << ", " << b[1] << ", " << "]" << std::endl; | ||
std::cout << "Info = " << info << std::endl; | ||
|
||
return(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <uuid/uuid.h> | ||
#include <iostream> | ||
|
||
int main() { | ||
uuid_t uuid{}; | ||
uuid_generate_random(uuid); | ||
std::cout << "uuid: " << uuid << std::endl; | ||
} |