Giter Club home page Giter Club logo

jsc32-xdev's Introduction

JSC32 Xdev

This set of scripts allows you to compile and run tests on JSC 32bits (MIPS or ARM) through emulation.

Creating a toolchain and a qemu-system installation

The first step is to use the script build.sh to build a toolchain and QEMU.

~ /home/pmatos/dev/jsc32-Xdev/build.sh -h
Usage:
	build.sh 
		[ -h | --help | --? ]     Show help and exit
		[ -a | --arch ]           Platform to build system for (required!)
                [ -j ]                    Number of cores to use during build (default: 40)
		[ --br2 "..." ]           Path to custom buildroot tree (default: checkout)
		[ --br2-version "..." ]   Buildroot tag to checkout (default: 2020.02)
		[ --br2-external "..." ]  Path to custom buildroot JSC external tree (default: checkout)
		[ --temp | --tmp "..." ]  Path to custom temporary directory (default: create)
		[ --version ]             Show version and exit
		output-directory          Directory to install buildroot to

For example:

$ export ARCH=arm
$ export INSTALL=${HOME}/roots/jsc32-${ARCH}
$ ./build.sh --arch ${ARCH} ${MIPSINSTALL}

This only needs to be done once and it will create an installation of a toolchain and QEMU in your home at $HOME/roots/jsc32-${ARCH}. Feel free to pass another non-existent directory to the script and it will install your brand new toolchain there.

ARCH can have two values: arm or mips.

Compiling JSC

To compile JSC you can use the script build-jsc.sh.

~ /home/pmatos/dev/jsc32-Xdev/build-jsc.sh -h
Usage:
	build-jsc.sh 
		[ -h | --help | --? ]     Show help and exit
		[ --version ]             Show version and exit
		[ --release | --debug ]   JSC Build mode (default: release)
		webkit-directory          Directory with WebKit checkout
		buildroot-directory       Directory with Buildroot install

I am assuming you have a WebKit checkout ready to be compiled. Doing so with the above toolchain is as easy as:

$ ./build-jsc.sh ${HOME}/dev/WebKit ${INSTALL}

Here you need to pass a path to an existing WebKit checkout and the folder to where you have your toolchain built using build.sh.

Testing JSC

Testing is started with test-jsc.sh.

~ /home/pmatos/dev/jsc32-Xdev/test-jsc.sh -h
Usage:
	test-jsc.sh 
		[ -h | --help | --? ]     Show help and exit
		[ --version ]             Show version and exit
		[ --timeout N ]           Set timeout per test (default: set by run-javascriptcore-tests)
		[ --release | --debug ]   JSC test mode (default: release)
                 [ --vms N ]               Number of vms to start for testing
		[ --filter REGEX ]        Filter for tests, passed unmodified to run-javascriptcore-tests
		[ --port P ]              Starting port for VMs (ports [P, P+N-1] need to be free
		webkit-directory          Directory with WebKit checkout
		buildroot-directory       Directory with Buildroot install

To test JSC, you can use as many virtual machines are you want as long as you have the necessary resources. The number of virtual machines should certainly be less or equal than the number of cores you have.

For example:

$ ./test-jsc.sh --vms 16 --port 61000 ${HOME}/dev/WebKit ${INSTALL}

Using docker to cross-compile JSC

It is not very simple to use Buildroot on macOS. Given that macOS is one of the main JSC development environment, docker images are available with toolchain already installed to be used on those environments. The ARMv7 container is available on pmatos/jsc-qemu-system-arm32, while the MIPS container is on pmatos/jsc-qemu-system-mips32el. Following command lines are considering the ARMv7 container, but MIPS version follows same steps.

To run a container we use the following command:

docker run -v <path to webkit on host machine>:/root/webkit -v <path to jsc32-Xdev>/:/root/jsc32-Xdev -ti pmatos/jsc-qemu-system-arm32 /bin/bash

It is important to notice the -v <path to webkit on host machine>:/root/webkit option. This will create a shared volume between host and guest container, so it is not necessary to checkout WebKit repository inside the container. We also share jsc32-Xdev, since it is where build scripts are located.

The command docker run will download the image and then launch a container executing /bin/bash. At this point we need to chage directory to /root/jsc32-Xdev and run build-jsc script.

cd /root/jsc32-Xdev
./build-jsc.sh /root/webkit/ /buildroot

The build time varies with the resource used by guest VM. After this command finishes, the binary is available on <path to webkit>/WebKitBuild.

The i386 special case

If you are using a x86_64 machine, there's no need to use qemu and therefore the build is much faster. There is an image prepared with the dependencies of WebKit called pmatos/jsc-x86_32.

Run the following (as above):

docker run -v <path to webkit on host machine>:/root/webkit -ti pmatos/jsc-x86_32 /bin/bash

You don't need to share the jsc32-Xdev volume since you can call the build-jsc and run-javascriptcore-tests directly.

Inside the image you can do ($ indicated the start of the shell):

$ cd /root/webkit
$ Tools/Scripts/build-jsc --32-bit --release --jsc-only
$ Tools/Scripts/run-javascriptcore-tests --jsc-only --release --no-build --no-fail-fast

jsc32-xdev's People

Contributors

pmatos avatar

Watchers

 avatar  avatar  avatar

jsc32-xdev's Issues

Start the container from script

One request of to allow something like the following:
build-jsc.sh --arch mips --container pmatos/jsc-qemu-system-mips32el:latest

Allow easy debugging on the remote qemu machine

Turns out that if a test fails, it's really hard to debug it because the whole system is removed upon exist of test-jsc. We should spend some time thinking about how to automate this debugging.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.