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

Reenable create-exe tests #3531

Merged
merged 22 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 88 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
build-what: [
{
key: capi,
build-cmd: 'make build-capi',
build-cmd: 'make build-capi && make package-capi',
name: 'Build C-API'
},
{
Expand Down Expand Up @@ -159,6 +159,26 @@ jobs:
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
PKG_CONFIG_ALLOW_CROSS: true
ENABLE_LLVM: 0
- name: Dist
if: ${{ matrix.build-what.key == 'capi' }}
run: |
make distribution
env:
CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross
CROSS_DOCKER_IN_DOCKER: true
CARGO_TARGET: aarch64-unknown-linux-gnu
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
PKG_CONFIG_ALLOW_CROSS: true
TARGET: aarch64-unknown-linux-gnu
TARGET_DIR: target/aarch64-unknown-linux-gnu/release
- name: Upload Artifacts
if: ${{ matrix.build-what.key == 'capi' }}
uses: actions/upload-artifact@v2
with:
name: capi-linux-aarch64
path: dist
if-no-files-found: error
retention-days: 2

build:
name: ${{ matrix.build-what.name }} on ${{ matrix.metadata.build }}
Expand Down Expand Up @@ -575,6 +595,73 @@ jobs:
aws-endpoint: https://storage.googleapis.com
aws-s3-bucket-endpoint: false
aws-s3-force-path-style: true
- name: Prepare package directory
shell: bash
run: |
mkdir -p package
mkdir -p package/cache
- uses: actions/download-artifact@v3
with:
name: capi-linux-aarch64
path: package/cache/wasmercache1
- uses: actions/download-artifact@v3
with:
name: capi-windows-gnu
path: package/cache/wasmercache2
- uses: actions/download-artifact@v3
with:
name: capi-macos-arm
path: package/cache/wasmercache3
- uses: actions/download-artifact@v3
with:
name: capi-macos-x64
path: package/cache/wasmercache4
- uses: actions/download-artifact@v3
with:
name: capi-linux-x64
path: package/cache/wasmercache5
- name: Copy .tar.gz files to proper location
shell: bash
run: |
ls package/cache/wasmercache1
ls package/cache/wasmercache2
ls package/cache/wasmercache3
ls package/cache/wasmercache4
ls package/cache/wasmercache5
cp package/cache/wasmercache1/wasmer.tar.gz package/cache/wasmer-linux-aarch64.tar.gz
cp package/cache/wasmercache2/build-capi.tar.gz package/cache/wasmer-windows-gnu64.tar.gz
cp package/cache/wasmercache3/build-capi.tar.gz package/cache/wasmer-darwin-arm64.tar.gz
cp package/cache/wasmercache4/build-capi.tar.gz package/cache/wasmer-darwin-amd64.tar.gz
cp package/cache/wasmercache5/build-capi.tar.gz package/cache/wasmer-linux-amd64.tar.gz
- uses: actions/download-artifact@v3
if: ${{ matrix.build == 'windows-x64' }}
with:
name: capi-windows-gnu
path: download_link
- uses: actions/download-artifact@v3
if: ${{ matrix.build == 'linux-musl' }}
with:
name: capi-linux-musl
path: download_link
- uses: actions/download-artifact@v3
if: ${{ matrix.build == 'macos-arm' }}
with:
name: capi-macos-arm
path: download_link
- uses: actions/download-artifact@v3
if: ${{ matrix.build == 'macos-x64' }}
with:
name: capi-macos-x64
path: download_link
- uses: actions/download-artifact@v3
if: ${{ matrix.build == 'linux-x64' }}
with:
name: capi-linux-x64
path: download_link
- name: Copy build-capi.tar.gz to link.tar.gz
shell: bash
run: |
cp download_link/build-capi.tar.gz link.tar.gz
- name: Unzip Artifacts
shell: bash
run: |
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ out.txt
wapm.toml
build-capi.tar.gz
build-wasmer.tar.gz
lcov.info
lcov.info
link/
link.tar.gz
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,12 @@ test-wasi-unit:
test-wasi:
$(CARGO_BINARY) test $(CARGO_TARGET_FLAG) --release --tests $(compiler_features) -- wasi::wasitests

test-integration-cli:
test-integration-cli: build-wasmer build-capi package dist
cp ./dist/wasmer.tar.gz ./link.tar.gz
rustup target add wasm32-wasi
$(CARGO_BINARY) test $(CARGO_TARGET_FLAG) --features webc_runner --no-fail-fast -p wasmer-integration-tests-cli -- --nocapture --test-threads=1

# Before running this in the CI, we need to set up link.tar.gz and /cache/wasmer-[target].tar.gz
test-integration-cli-ci:
rustup target add wasm32-wasi
$(CARGO_BINARY) test $(CARGO_TARGET_FLAG) --features webc_runner -p wasmer-integration-tests-cli -- --nocapture --test-threads=1 || $(CARGO_BINARY) test $(CARGO_TARGET_FLAG) --features webc_runner --no-fail-fast -p wasmer-integration-tests-cli -- --nocapture --test-threads=1
Expand Down Expand Up @@ -618,6 +620,7 @@ endif
package-capi:
mkdir -p "package/include"
mkdir -p "package/lib"
mkdir -p "package/winsdk"
cp lib/c-api/wasmer.h* package/include
cp lib/c-api/wasmer_wasm.h* package/include
cp lib/c-api/tests/wasm-c-api/include/wasm.h* package/include
Expand Down Expand Up @@ -728,7 +731,7 @@ package: package-wasmer package-minimal-headless-wasmer package-capi

tar-capi:
ls -R package
tar -C package -zcvf build-capi.tar.gz lib include
tar -C package -zcvf build-capi.tar.gz lib include winsdk

untar-capi:
mkdir -p package
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ publish = false

[dev-dependencies]
rand = "0.8.5"
tar = "0.4.38"
flate2 = "1.0.24"
target-lexicon = "0.12.4"
pretty_assertions = "1.3.0"
object = "0.30.0"
Expand All @@ -19,6 +17,8 @@ object = "0.30.0"
anyhow = "1"
tempfile = "3"
target-lexicon = "0.12.5"
tar = "0.4.38"
flate2 = "1.0.24"

[features]
default = ["webc_runner"]
Expand Down
68 changes: 13 additions & 55 deletions tests/integration/cli/tests/create_exe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ impl WasmerCreateExe {
output.args(self.extra_cli_flags.iter());
output.arg("-o");
output.arg(&self.native_executable_path);
if !self.extra_cli_flags.contains(&"--target".to_string()) {
let tarball_path = get_repo_root_path().unwrap().join("link.tar.gz");
assert!(tarball_path.exists(), "link.tar.gz does not exist");
output.arg("--tarball");
output.arg(&tarball_path);
}
let cmd = format!("{:?}", output);

println!("(integration-test) running create-exe: {cmd}");
Expand Down Expand Up @@ -257,14 +263,8 @@ fn test_create_exe_with_precompiled_works_1() {

// Ignored because of -lunwind linker issue on Windows
// see https://github.com/wasmerio/wasmer/issues/3459
// #[cfg_attr(target_os = "windows", ignore)]
#[cfg_attr(target_os = "windows", ignore)]
#[test]
// Test temporarily ignored during the release of 3.2.0-alpha
// because create-exe links to the old libwasmer.a which expects
// MetadataHeader::VERSION == 1, but we want to upgrade to version 2.
//
// https://github.com/wasmerio/wasmer/issues/3513
#[ignore]
fn create_exe_works() -> anyhow::Result<()> {
let temp_dir = tempfile::tempdir()?;
let operating_dir: PathBuf = temp_dir.path().to_owned();
Expand Down Expand Up @@ -301,14 +301,8 @@ fn create_exe_works() -> anyhow::Result<()> {
/// Tests that "-c" and "-- -c" are treated differently
// Ignored because of -lunwind linker issue on Windows
// see https://github.com/wasmerio/wasmer/issues/3459
// #[cfg_attr(target_os = "windows", ignore)]
#[cfg_attr(target_os = "windows", ignore)]
#[test]
// Test temporarily ignored during the release of 3.2.0-alpha
// because create-exe links to the old libwasmer.a which expects
// MetadataHeader::VERSION == 1, but we want to upgrade to version 2.
//
// https://github.com/wasmerio/wasmer/issues/3513
#[ignore]
fn create_exe_works_multi_command_args_handling() -> anyhow::Result<()> {
let temp_dir = tempfile::tempdir()?;
let operating_dir: PathBuf = temp_dir.path().to_owned();
Expand Down Expand Up @@ -373,14 +367,8 @@ fn create_exe_works_multi_command_args_handling() -> anyhow::Result<()> {

// Ignored because of -lunwind linker issue on Windows
// see https://github.com/wasmerio/wasmer/issues/3459
// #[cfg_attr(target_os = "windows", ignore)]
#[cfg_attr(target_os = "windows", ignore)]
#[test]
// Test temporarily ignored during the release of 3.2.0-alpha
// because create-exe links to the old libwasmer.a which expects
// MetadataHeader::VERSION == 1, but we want to upgrade to version 2.
//
// https://github.com/wasmerio/wasmer/issues/3513
#[ignore]
fn create_exe_works_multi_command() -> anyhow::Result<()> {
let temp_dir = tempfile::tempdir()?;
let operating_dir: PathBuf = temp_dir.path().to_owned();
Expand Down Expand Up @@ -436,14 +424,8 @@ fn create_exe_works_multi_command() -> anyhow::Result<()> {

// Ignored because of -lunwind linker issue on Windows
// see https://github.com/wasmerio/wasmer/issues/3459
// #[cfg_attr(target_os = "windows", ignore)]
#[cfg_attr(target_os = "windows", ignore)]
#[test]
// Test temporarily ignored during the release of 3.2.0-alpha
// because create-exe links to the old libwasmer.a which expects
// MetadataHeader::VERSION == 1, but we want to upgrade to version 2.
//
// https://github.com/wasmerio/wasmer/issues/3513
#[ignore]
fn create_exe_works_with_file() -> anyhow::Result<()> {
let temp_dir = tempfile::tempdir()?;
let operating_dir: PathBuf = temp_dir.path().to_owned();
Expand Down Expand Up @@ -509,12 +491,6 @@ fn create_exe_works_with_file() -> anyhow::Result<()> {
// see https://github.com/wasmerio/wasmer/issues/3459
#[cfg_attr(target_os = "windows", ignore)]
#[test]
// Test temporarily ignored during the release of 3.2.0-alpha
// because create-exe links to the old libwasmer.a which expects
// MetadataHeader::VERSION == 1, but we want to upgrade to version 2.
//
// https://github.com/wasmerio/wasmer/issues/3513
#[ignore]
fn create_exe_serialized_works() -> anyhow::Result<()> {
let temp_dir = tempfile::tempdir()?;
let operating_dir: PathBuf = temp_dir.path().to_owned();
Expand Down Expand Up @@ -697,42 +673,24 @@ fn create_exe_with_object_input(args: Vec<String>) -> anyhow::Result<()> {

// Ignored because of -lunwind linker issue on Windows
// see https://github.com/wasmerio/wasmer/issues/3459
// #[cfg_attr(target_os = "windows", ignore)]
#[cfg_attr(target_os = "windows", ignore)]
#[test]
// Test temporarily ignored during the release of 3.2.0-alpha
// because create-exe links to the old libwasmer.a which expects
// MetadataHeader::VERSION == 1, but we want to upgrade to version 2.
//
// https://github.com/wasmerio/wasmer/issues/3513
#[ignore]
fn create_exe_with_object_input_default() -> anyhow::Result<()> {
create_exe_with_object_input(vec![])
}

// Ignored because of -lunwind linker issue on Windows
// see https://github.com/wasmerio/wasmer/issues/3459
// #[cfg_attr(target_os = "windows", ignore)]
#[cfg_attr(target_os = "windows", ignore)]
#[test]
// Test temporarily ignored during the release of 3.2.0-alpha
// because create-exe links to the old libwasmer.a which expects
// MetadataHeader::VERSION == 1, but we want to upgrade to version 2.
//
// https://github.com/wasmerio/wasmer/issues/3513
#[ignore]
fn create_exe_with_object_input_symbols() -> anyhow::Result<()> {
create_exe_with_object_input(vec!["--object-format".to_string(), "symbols".to_string()])
}

// Ignored because of -lunwind linker issue on Windows
// see https://github.com/wasmerio/wasmer/issues/3459
// #[cfg_attr(target_os = "windows", ignore)]
#[cfg_attr(target_os = "windows", ignore)]
#[test]
// Test temporarily ignored during the release of 3.2.0-alpha
// because create-exe links to the old libwasmer.a which expects
// MetadataHeader::VERSION == 1, but we want to upgrade to version 2.
//
// https://github.com/wasmerio/wasmer/issues/3513
#[ignore]
fn create_exe_with_object_input_serialized() -> anyhow::Result<()> {
create_exe_with_object_input(vec![
"--object-format".to_string(),
Expand Down
Loading