AROS Exec

Development => AROS Software Development => Topic started by: leeg on May 21, 2020, 07:49:28 PM

Title: Using hosted AROS for Continuous Integration?
Post by: leeg on May 21, 2020, 07:49:28 PM
Hi, I want to use AROS as an environment to build and test my Amiga software in continuous integration, probably using Github actions. Has anybody done this and have experience they can share, please?

The rough outline of my plan:

Is there a way to find out in the host OS whether S:User-Startup failed? I guess at worst I could write a file containing the test results and watch for it appearing in the host, anyone tried that?
Title: Re: Using hosted AROS for Continuous Integration?
Post by: deadwood on May 21, 2020, 09:03:13 PM
You should check AROS/scripts/nightly. AROS is having some internal tests that are being run at each build and probably you can use the same mechanism.
Title: Re: Using hosted AROS for Continuous Integration?
Post by: leeg on May 21, 2020, 09:05:15 PM
Amazing, thanks! If I get it working Iíll write it up as a HOWTO :)
Title: Re: Using hosted AROS for Continuous Integration?
Post by: deadwood on May 21, 2020, 09:28:50 PM
Other way is trying this:

https://ae.amigalife.org/index.php?topic=561.0

It will build a linux binary out of your application which might be easier to integrated with existing testing pipelines.
Title: Re: Using hosted AROS for Continuous Integration?
Post by: leeg on May 21, 2020, 10:52:36 PM
Oh yeah, that'll definitely be easier for running in CI, thanks.
Title: Re: Using hosted AROS for Continuous Integration?
Post by: leeg on May 22, 2020, 06:48:06 PM
I tried AxRuntime first, unfortunately it's not going to work for me. It was really easy to get installed and set up, but then I hit problems. A small problem is that I was building with the flags "-std=c89 -pedantic -Werror -Wall" with gcc (my project builds with Hisoft C on real Amigas, and I need to remember not to do anything modern/undefined on Linux). I removed those flags and my test program builds. But on running, it runs to completion then traps on exit:

Thread 14 "New Process" received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 0x7fffce7fc700 (LWP 23058)]
RunProgram (sysbase=0x7ffff00017c0, _m=0x7fffffffcac0) at /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/arch/all-runtime/axrt/startup/startup_lib.c:222
222     /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/arch/all-runtime/axrt/startup/startup_lib.c: No such file or directory.
(gdb) bt
#0  RunProgram (sysbase=0x7ffff00017c0, _m=0x7fffffffcac0) at /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/arch/all-runtime/axrt/startup/startup_lib.c:222
#1  0x00007fffef79d4d9 in __program_trampoline () at /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/arch/all-runtimelinux/dos/boot.c:83
#2  0x00007fffef79dd0a in CallEntry (argptr=0x0, argsize=0, entry=0x7fffef79d3d4 <__program_trampoline>, me=0x7fffc80167a0)
    at /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/arch/all-runtimelinux/dos/exit.c:136
#3  0x00007fffef7a50fa in DosEntry () at /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/rom/dos/./createnewproc.c:741
#4  0x00007ffff5d7cf50 in __pthread_trampoline (ptr=0x7fffc8021380) at /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/arch/all-runtimelinux/exec/newaddtask.c:287
#5  0x00007ffff75996db in start_thread (arg=0x7fffce7fc700) at pthread_create.c:463
#6  0x00007ffff78d288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

If you want to look further, check out the libaxrt branch in https://github.com/iamleeg/Amiga-Smalltalk
Title: Re: Using hosted AROS for Continuous Integration?
Post by: deadwood on May 23, 2020, 07:42:36 AM
So for me to understand: the problem that is blocking you is that the program SIGTRAPs at end instead of gracufully exiting with return code, correct?
Title: Re: Using hosted AROS for Continuous Integration?
Post by: leeg on May 26, 2020, 02:44:02 PM
Yeah, that's right. I'd rather rely on the return code to know whether my tests passed than parse the standard output and ignore any crashing. I know it's possible that I've used something incorrectly and I'm triggering the crash, but that isn't obviously the case based on the backtrace.
Title: Re: Using hosted AROS for Continuous Integration?
Post by: deadwood on May 26, 2020, 04:01:06 PM
Ok, I got it. The problem is on AxRuntime side, there is some missing functionality. Let me take a stab at implementig it. I should have a patch for you in coming days.
Title: Re: Using hosted AROS for Continuous Integration?
Post by: deadwood on May 26, 2020, 07:40:10 PM
Try this version:

https://www.axrt.org/development/libaxrt.so.40.1.20200526

Remove the postfix and place libaxrt.so in the same directory as your executable. Alternativelly copy it to /usr/lib/x86_64-linux/gnu/ for system-wide installation.
Title: Re: Using hosted AROS for Continuous Integration?
Post by: leeg on May 29, 2020, 04:40:50 PM
Great! That version works well, and the process exits cleanly. Thank you!
Title: Re: Using hosted AROS for Continuous Integration?
Post by: deadwood on May 29, 2020, 06:31:13 PM
Great. It will be included in next release. If you run into more problems, let me know.
Title: Re: Using hosted AROS for Continuous Integration?
Post by: leeg on May 29, 2020, 06:55:48 PM
Well, this was quick :). It worked locally, but doesn't work in a github action (which AFAICT is run in an Azure VM, on ubuntu 18.04.4 which is the same host OS I'm using). The problems I encountered:

1. after installing the pkgs, the runner user couldn't read /usr/lib/x86_64-linux-gnu/axrt/2.0//UserSYS/Prefs/Env-Archive/SYS/ahi.prefs, so I had to manually chmod (see https://github.com/iamleeg/Amiga-Smalltalk/runs/721012858?check_suite_focus=true)
2. having changed that, the process crashes on launch. Backtrace:

#0  Exec_69_CloseLibrary (library=0x7ffff0025ee0, SysBase=0x7ffff00017c0)
    at /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/arch/all-runtimelinux/exec/closelibrary.c:68
#1  0x00007fffeef71080 in __inline_Exec_CloseLibrary (__arg1=0x7ffff0025ee0,
    __SysBase=0x7ffff00017c0)
    at /ssd/deadwood/repo-github-dd-alt-runtimelinux/alt-runtimelinux-x86_64-d/bin/runtimelinux-x86_64/AROS/Developer/include/inline/exec.h:836
#2  0x00007fffeef7125f in _set_close_libraries_list (
    list=0x7fffef1786d0 <__LIBS_LIST__>, SysBase=0x7ffff00017c0)
    at /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/compiler/autoinit/./libraries.c:72
#3  0x00007fffeef5d560 in X11Cl_InitLib (X11ClBase=0x7ffff005ead0,
    segList=0x0, sysBase=0x7ffff00017c0)
    at /ssd/deadwood/repo-github-dd-alt-runtimelinux/alt-runtimelinux-x86_64-d/bin/runtimelinux-x86_64/gen/arch/all-hosted/hidd/x11/x11gfx/x11gfx_start.c:207
#4  0x00007ffff5d8b030 in Exec_17_InitResident (
    resident=0x7fffeef5eb60 <X11Cl_ROMTag>, segList=0x0,
    SysBase=0x7ffff00017c0)
    at /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/rom/exec/./initresident.c:129
#5  0x00007ffff5d8ab5c in __inline_Exec_InitResident (
    __arg1=0x7fffeef5eb60 <X11Cl_ROMTag>, __arg2=0x0, __SysBase=0x7ffff00017c0)
    at /ssd/deadwood/repo-github-dd-alt-runtimelinux/alt-runtimelinux-x86_64-d/bin/runtimelinux-x86_64/AROS/Developer/include/inline/exec.h:126
#6  0x00007ffff5d8acd6 in Exec_12_InitCode (startClass=1, version=0,
    SysBase=0x7ffff00017c0)
    at /ssd/deadwood/repo-github-dd-alt-runtimelinux/AROS/rom/exec/./initcode.c:97
#7  0x00007ffff7bc3aed in ?? () from /usr/lib/x86_64-linux-gnu/libaxrt.so
#8  0x00007ffff7bc44ff in ?? () from /usr/lib/x86_64-linux-gnu/libaxrt.so
#9  0x00007ffff7bc45bf in ?? () from /usr/lib/x86_64-linux-gnu/libaxrt.so
#10 0x00007ffff75986db in start_thread (arg=0x7ffff67ac700)
    at pthread_create.c:463
#11 0x00007ffff78d188f in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Title: Re: Using hosted AROS for Continuous Integration?
Post by: deadwood on May 29, 2020, 07:38:42 PM
I tries to connect to X server which you probably don't have installed on your VM? This one will be a bit tougher to resolve, but I remember we had some "fake" X server installed on build AROS machines that was good enough to execute AROS "headless".

Here is what I found in dev ml meails:

"We currently use Xvfb (a null X server) for this purpose."

Title: Re: Using hosted AROS for Continuous Integration?
Post by: leeg on May 29, 2020, 07:52:57 PM
Ah yes, that makes sense, thanks. Iíll try it out.
Title: Re: Using hosted AROS for Continuous Integration?
Post by: leeg on May 30, 2020, 10:39:23 AM
That was it, thank you! I appreciate your support and patience, and your work on AROS and libaxrt! I now have working CI :-D

https://github.com/iamleeg/Amiga-Smalltalk/actions/runs/119770761
Title: Re: Using hosted AROS for Continuous Integration?
Post by: deadwood on May 30, 2020, 01:10:09 PM
I'm really glad it worked for you - this was why I created AxRuntime in the first place - to help other developers. I actually did not foresee it being used to CI - but now it seems like an obious use case. I also added an enhancement for future to be able to run it "headless" (without need for fake X).

I think you mentioned that you want to also write a post on how to achieve CI for other. If you do so, let me know :)
Title: Re: Using hosted AROS for Continuous Integration?
Post by: leeg on May 30, 2020, 09:50:41 PM
https://www.sicpers.info/2020/05/continuous-integration-for-amiga/ :)
Title: Re: Using hosted AROS for Continuous Integration?
Post by: deadwood on May 30, 2020, 11:35:43 PM
Thanks!