#130 tests/fedora-flags: Run test on all architectures using qemu
Opened 9 months ago by tstellar. Modified 8 months ago
rpms/ tstellar/clang multi-arch-test  into  rawhide

@@ -2,4 +2,8 @@ 

  test: ./test.sh

  require:

    - annobin

+   - koji

+   - mock

+   - qemu-user-static

    - redhat-rpm-config

+ duration: 120m

@@ -0,0 +1,30 @@ 

+ #!/bin/bash

+ 

+ set -ex pipefail

+ 

+ function check_flags {

+     if [ -z "$1" ]; then

+         echo "FAIL: failed to get rpm flags"

+         exit 1

+     fi

+ }

+ 

+ cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`

+ cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`

+ ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`

+ 

+ check_flags "$cflags"

+ check_flags "$cxxflags"

+ check_flags "$ldflags"

+ 

+ # Test a c program

+ clang $cflags -c hello.c -o hello.o

+ clang $cflags -c main.c -o main.o

+ clang $ldflags -o hello main.o hello.o

+ ./hello | grep "Hello World"

+ 

+ # Test a cxx program

+ clang++ $cxxflags -c hello.cpp -o hello-cpp.o

+ clang++ $cxxflags -c main.cpp -o main-cpp.o

+ clang++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o

+ ./hello-cpp | grep "Hello World"

file modified
+31 -14
@@ -1,20 +1,37 @@ 

  #!/bin/sh -eux

  

- set pipefail

+ env

  

- cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`

- cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`

- ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`

+ status=0

  

+ arches="aarch64 armhfp i386 ppc64le s390x x86_64"

+ chroot_home='/builddir/'

  

- # Test a c program

- clang $cflags -c hello.c -o hello.o

- clang $cflags -c main.c -o main.o

- clang $ldflags -o hello main.o hello.o

- ./hello | grep "Hello World"

+ for arch in $arches; do

+     case $arch in

+         armhfp)

+             koji_arch="armv7hl"

+             ;;

+         i386)

+             koji_arch="i686"

+             ;;

+         *)

+             koji_arch=$arch

+             ;;

+     esac

+     root="fedora-rawhide-$arch"

+     mock -r $root --install clang

+     mkdir $arch && pushd $arch

+     koji download-build --arch $koji_arch --noprogress --task-id $TASK_ID

+     popd

+     mock -r $root --install $arch/*.rpm

+     mock -r $root --copyin main.c main.cpp hello.c hello.cpp test-clang.sh $chroot_home

+     if mock -r $root --config-opts="chroothome=$chroot_home" --shell bash test-clang.sh; then

+         echo "$arch: PASS"

+     else

+         echo "$arch: FAIL"

+         status=1

+     fi

+ done

  

- # Test a cxx program

- clang++ $cxxflags -c hello.cpp -o hello-cpp.o

- clang++ $cxxflags -c main.cpp -o main-cpp.o

- clang++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o

- ./hello-cpp | grep "Hello World"

+ exit $status

no initial comment

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

rebased onto c6d3ed0

9 months ago

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

LGTM. The test is failing, though, but that seems to be a minor inconvenience, the refactoring makes sense to me.

@happz It's failing because the test runner does not provide the TASK_ID environment variable as I was expecting. So, in order to merge this we need to find some way to access the task id of the koji build.

@tstellar I see. Right, and there's not much to play with, judging by the output of env.

I think there should be files produced by tmt, under its working directory (like /var/ARTIFACTS/work-default11eLwy/), and tmt does store plenty of information, maybe even the NVR of the build(s) under the test and so on. No guarantees, but I guess we could take a look there, with a bit of grep we might get something.

Also, I can ping guys on #tmt tomorrow to get more tips. This may be a question for Fedora CI folks, too, rather than tmt.

So there's no TEST_ID or any similar variable, and the problem is on Fedora CI's table, Testing Farm and tmt are not given any variables of this kind.

Turning my eye to grep - if nothing else, tmt must know what build to install, at least...