Publish Vulpes Preview 15 sources for desktop, Android and Tundra

Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

29
gaia/bin/chunk Executable file
View file

@ -0,0 +1,29 @@
#! /usr/bin/env python
import argparse
import math
parser = argparse.ArgumentParser(description='Chunk a list of files')
parser.add_argument('total_chunks', metavar='<total-chunks>', type=float,
help='total number of chunks')
parser.add_argument('this_chunk', metavar='<nth-chunk>', type=float,
help='Nth chunk to run')
parser.add_argument('files', metavar='files', type=str,
nargs='+', help='files to sort and chunk')
args = parser.parse_args()
def main(args):
if len(args.files) < args.total_chunks:
print(' '.join(args.files))
return
chunk_length = int(math.ceil(len(args.files) / args.total_chunks))
chunk = int((args.this_chunk - 1) * chunk_length)
print(' '.join(args.files[chunk:chunk + chunk_length]))
main(args)

61
gaia/bin/ci Executable file
View file

@ -0,0 +1,61 @@
#! /bin/bash -e
# XXX: At some point we probably don't need travis specific logic but for now
# it's very easy to use this with environment variables to keep everything
# running as it does in travis.
# test suite root for all travis ci hook style tests...
suite_root="tests/ci"
usage() {
echo
echo " Usage: ./bin/ci [command] [args]"
echo
echo " Commands:"
echo
echo " run <suite> - run a particular test suite (use ls to see all suites)"
echo " ls - list all the test suites which can be run"
echo
echo
}
cmd_ls() {
ls $suite_root
}
cmd_run() {
local steps="before_install install before_script script"
local root="$suite_root/$1/"
if [ ! -d $root ] || [ "$1" == "" ] || [ "$1" == " " ];
then
echo "CI suite $1 does not exist in path $root"
echo
echo "Allowed suites:"
echo
echo "$(cmd_ls)"
echo
usage
exit 1
fi
for step in $steps; do
if [ -x "$root/$step" ];
then
eval "$root/$step"
fi
done
}
case "$1" in
"run")
cmd_run ${@:2}
;;
"ls")
cmd_ls
;;
*)
usage
;;
esac

View file

@ -0,0 +1,187 @@
#!/bin/bash -ex
# All options are passed to `./node_modules/.bin/marionette-mocha` so
# you can also use mocha commands like `--grep`, `--timeout` see `--help`
# for more options.
export MOZ_DISABLE_NONLOCAL_CONNECTIONS=1
# Force the locale in this script so that it's reproducible
export LC_ALL=C
# Find the source of this file. This will exist in
# $GAIA/node_modules/.bin/gaia-marionette.
SOURCE="${BASH_SOURCE[0]}"
# Make it an absolute path
DIR="$(cd "$(dirname $SOURCE)" && pwd)"
BINDIR="$(cd "$DIR/../../bin" && pwd)"
BUILDAPP=${BUILDAPP:-desktop}
safe_which() {
if [ "$(which $1)" ];
then
which $1
fi
}
# Go to the isolated Python environment if we already setup the virtualenv.
VIRTUALENV=$(safe_which virtualenv)
CI_VENV=$(find $BINDIR/.. -path "*/ci_venv")
if [ -x "$VIRTUALENV" -a -x "$CI_VENV" ]; then
source ./ci_venv/bin/activate
fi
# We skip the related tests if the Radicale CalDAV server is not installed.
if [ ! -x "$VIRTUALENV" -o ! -x "$CI_VENV" -o ! -x "$(safe_which radicale)" ]; then
echo -e "The Radicale CalDAV server is not installed in the virtualenv, we will skip the CalDAV tests.\n \
\rIf you want to run the CalDAV tests, please run |make caldav-server-install| first."
CALDAV_RELATED_TESTS="apps/calendar/test/marionette/caldav_test.js apps/calendar/test/marionette/server_test.js"
SKIP_TEST_FILES="$SKIP_TEST_FILES $CALDAV_RELATED_TESTS"
fi
# Build the script string of skipping test files.
if [ -n "$SKIP_TEST_FILES" ]; then
for FILE in $SKIP_TEST_FILES
do
SKIP_TEST_FILES_SCRIPT="$SKIP_TEST_FILES_SCRIPT ! -path */$FILE"
done
SKIP_TEST_FILES="$SKIP_TEST_FILES_SCRIPT"
fi
HARNESS_PATHS="$(cat "$BINDIR/../tests/jsmarionette/marionette_tests.txt")"
if [ -z "$TEST_FILES" ]; then
if [ -z "$APP" ]; then
if [ -z "$HARNESS_ONLY" ]; then
TEST_FILES=$(find "$BINDIR/.." -path "*/apps/*/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/dev_apps/*/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/tv_apps/*/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/tests/integration/*/*_test.js" $SKIP_TEST_FILES)
else
TEST_FILES=""
fi
for wildcard in $HARNESS_PATHS; do
HARNESS_FILES=$(find "$BINDIR/../tests/jsmarionette" -path $wildcard $SKIP_TEST_FILES)
TEST_FILES="$TEST_FILES"$'\n'"$HARNESS_FILES" # $'\n' is a bashism to insert a litteral new line
done
else
TEST_FILES=$(find "$BINDIR/.." -path "*/apps/$APP/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/dev_apps/$APP/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/tv_apps/$APP/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/tests/integration/$APP/*_test.js" $SKIP_TEST_FILES)
fi
fi
if [ -n "$PART" ] ; then
if [ -z "$NBPARTS" ] ; then
echo "You need to specify the number of parts using the env variable NBPARTS"
exit 1
fi
TEMP_FILE=$(mktemp)
# the quotes are important here, otherwise bash replace newlines characters by
# spaces
echo "$TEST_FILES" | sort > $TEMP_FILE
TEST_FILES=$(split -n l/$PART/$NBPARTS $TEMP_FILE)
rm -f $TEMP_FILE
fi
if [ -z "$XULRUNNER_DIRECTORY" ] ; then
# the xulrunner directory isn't in the environment
XULRUNNER_DIRECTORY=$(ls -d "$BINDIR"/../b2g_sdk/* | sort -nr | head -n1 2> /dev/null)
fi
if [ -z "$XPCSHELLSDK" ] ; then
XPCSHELLSDK=$(find "$XULRUNNER_DIRECTORY" -type f -name xpcshell | sort -nr | head -n1 2> /dev/null)
fi
# find xpcshell and put it in the path
XPCSHELL_DIR=$(dirname "$XPCSHELLSDK")
HOST_LOG_OPTS=""
if [ "$HOST_LOG" ]; then
HOST_LOG_OPTS="--host-log $HOST_LOG"
fi
VERBOSE_OPTS=""
if [ "$VERBOSE" ]; then
VERBOSE_OPTS="--verbose"
fi
OOP_OPTS=""
if [ "$OOP" ]; then
OOP_OPTS="--b2g-desktop-oop"
fi
RUNTIME_OPTS=""
if [ "$RUNTIME" ]; then
RUNTIME_OPTS="--runtime $RUNTIME"
fi
# Dirty hack until we can kill this file or fix passing DEBUG to profile
# construction.
if [ ! -z "$NODE_DEBUG" ];
then
export DEBUG=$NODE_DEBUG
fi
if [ "$BUILDAPP" != "desktop" ] ; then
LANG="en_US.UTF-8"
export LANG
BUILDAPP_OPTS="--buildapp $BUILDAPP"
fi
DEVICE_OPTS=""
if [ "$B2G_HOME" ]; then
DEVICE_OPTS="--b2g-home $B2G_HOME"
fi
if [ "$SYMBOLS" ]; then
DEVICE_OPTS="$ADDITIONAL_OPTS --symbols-path $SYMBOLS"
fi
if [ "$DEVICE_SERIAL" ]; then
DEVICE_OPTS="$ADDITIONAL_OPTS --serial $DEVICE_SERIAL"
fi
if [ "$DUMP_PATH" ]; then
DEVICE_OPTS="$ADDITIONAL_OPTS --dump-path $DUMP_PATH"
fi
DEVICE_TYPE_OPT=""
if [ -z "$GAIA_DEVICE_TYPE" ] || [ "$GAIA_DEVICE_TYPE" = "phone" ]; then
DEVICE_TYPE_OPT="--device-type phone"
else
DEVICE_TYPE_OPT="--device-type $GAIA_DEVICE_TYPE"
fi
TARGET="$DIR/marionette-mocha"
export PATH=$XPCSHELL_DIR:$PATH
if [ ! -z $TEST_MANIFEST ]; then
TEST_FILES="$("$DIR/apply-manifest" $TEST_MANIFEST $TEST_FILES)"
fi
# Now that we've applied the manifest we can actually report which tests
# will get run.
PRETTY_TEST_FILES=$(echo $TEST_FILES | tr " " "\n" | sort)
echo -e "------- Will run the following test files:\n$PRETTY_TEST_FILES\n-------"
# We export _RETRY_TEST_FILES here to enable gaia_marionette_retry to self
# diagnose in the case where we told it to run tests but it ran none.
export _RETRY_TEST_FILES=$TEST_FILES
# wrap marionette-mocha with gaia's defaults. We also need to alter the paths to
# xpcshell in available for email fake servers.
$TARGET \
$VERBOSE_OPTS \
$HOST_LOG_OPTS \
$OOP_OPTS \
$RUNTIME_OPTS \
$DEVICE_OPTS \
$BUILDAPP_OPTS \
$TEST_FILES \
$DEVICE_TYPE_OPT \
--profile-builder "$DIR/../gaia-marionette/node_modules/profile-builder" \
$@

View file

@ -0,0 +1,12 @@
{
"name": "gaia-marionette",
"version": "0.0.1",
"bin": "./gaia-marionette",
"dependencies": {
"es6-promise": "2.0.1",
"marionette-js-runner": "file:../../tests/jsmarionette/runner/marionette-js-runner",
"mocha-tbpl-reporter": "file:../../tests/jsmarionette/mocha/mocha-tbpl-reporter",
"profile-builder": "file:../../shared/test/integration/profile-builder"
}
}

228
gaia/bin/gaia-test Executable file
View file

@ -0,0 +1,228 @@
#!/bin/bash
SELF=`basename $0`
SELF_DIR=`dirname $0`
#
# Run the gaia unit test agent server and with firefox.
#
# Basic usage:
#
# gaia-test <gaia location> <firefox binary>
#
# The both parameters are optional.
#
# The gaia directory to test is found using the following heuristic:
# 1) If the gaia location specified on the command line is a directory,
# then use it.
# 2) If the gaia location is not specified, use the $GAIADIR environment
# variable.
# 2) If the environment variable is not specified either, then use
# the scripts location to determine the gaia directory. This assumes
# the script is found in gaia/bin.
#
# The firefox binary is found using the following heuristic:
# 1) If the firefox binary is specified on the command line, then attempt
# to find it in the path if its relative or just use it if its absolute.
# 2) If the firefox binary is not specified, then use the $FIREFOX
# environment variable to find the executable in the path.
# 3) If the environment is not specified either, then look for 'firefox'
# in the path.
#
usage() {
echo "$SELF [ -d ] [ -f ] [ -g ] [ -h ] [ <gaia dir> [ <firefox/B2G binary> ] ]"
echo " -d: runs in B2G Desktop"
echo " -f: forces the profile generation -- will delete an existing profile directory"
echo " -g: runs in gdb"
echo " -h: displays this help"
echo
echo "Use the environment variable FIREFOX to point to a specific firefox binary."
echo "Use the environment variable B2G to point to a specific B2G Desktop binary."
echo "Use the environment variable GAIADIR to point to a specific Gaia directory."
echo -n "Use the environment variable PROFILE_FOLDER to change the profile directory."
echo " It should be a subdirectory of the Gaia directory."
echo "Use the environment variable GDB_ARGS to pass arguments to gdb."
exit 1
}
handle_options() {
mode="firefox"
force_profile=
runs_in_gdb=
while getopts dfgh f; do
case $f in
d)
mode="b2g"
;;
f)
force_profile=1
;;
g)
runs_in_gdb="gdb $GDB_ARGS --args"
;;
h|\?)
usage
;;
esac
done
}
configure_gaia_location() {
#
# Configure gaia location
#
if [ ! -z "$1" ] ; then
GAIADIR="$1"
fi
if [ -z "$GAIADIR" ] ; then
GAIADIR="$SELF_DIR/.."
fi
if [ ! -d "$GAIADIR" ] ; then
echo "$SELF: '$GAIADIR' is not a directory!"
exit 1
fi
GAIADIR=$( cd "$GAIADIR"; pwd)
echo "$SELF: Using gaia at '$GAIADIR'."
}
configure_firefox_location() {
#
# Configure firefox test binary
#
if [ ! -z "$1" ] ; then
FIREFOX="$1"
fi
if [ -z "$FIREFOX" ] ; then
FIREFOX='firefox'
fi
BASE_FIREFOX="$FIREFOX"
FIREFOX=`which $BASE_FIREFOX`
if [ ! -x "$FIREFOX" ] ; then
echo "$SELF: Unable to find an executable '$BASE_FIREFOX' in path!"
exit 1
fi
#
# Verify firefox version is new enough
#
VERSION=`$FIREFOX --version | awk '{print $3}'`
REQ_VERSION='22'
if expr "$VERSION" \< "$REQ_VERSION" >/dev/null ; then
echo "$SELF: Firefox is only version $VERSION; use $REQ_VERSION or newer."
exit 1
fi
echo "$SELF: Using Firefox $VERSION at '$FIREFOX'."
}
configure_b2g_location() {
#
# Configure mulet test binary
#
if [ ! -z "$1" ] ; then
B2G=`which $1`
if [ ! -x "$B2G" ] ; then
echo "$SELF: Unable to find an executable '$1' in path!"
exit 1
fi
fi
if [ -z "$B2G" ] ; then
make mulet
B2G="./firefox/firefox-bin"
if [ ! -x "$B2G" ] ; then
# set the path for Mac OS X
B2G="./firefox/Contents/MacOS/firefox-bin"
fi
fi
# if we still don't have it, fail
if [ ! -x "$B2G" ] ; then
echo "$SELF: Couldn't download a suitable executable for B2G Desktop"
exit 1
fi
echo "$SELF: Using B2G Desktop at '$B2G'."
}
configure_profile_folder() {
if [ -z "$PROFILE_FOLDER" ] ; then
PROFILE_FOLDER="profile-gaia-test-$mode"
fi
export PROFILE_FOLDER
echo "$SELF: Using profile at '$PROFILE_FOLDER'"
}
generate_profile_folder_if_needed() {
if [ -n "$force_profile" ] ; then
rm -rf "$PROFILE_FOLDER"
fi
if [ ! -d "$PROFILE_FOLDER" ] ; then
echo "$SELF: Building the debug profile."
NO_LOCK_SCREEN=1 DEBUG=1 DESKTOP=0 make
fi
}
launch_test_runner_in_firefox() {
#
# Launch firefox
#
$runs_in_gdb $FIREFOX --no-remote -profile "$GAIADIR/$PROFILE_FOLDER" app://test-agent.gaiamobile.org/
}
launch_test_runner_in_b2g() {
$runs_in_gdb $B2G -profile "$GAIADIR/$PROFILE_FOLDER" --runapp 'Test Agent'
}
prepare_npm_modules() {
make node_modules
}
handle_options "$@" && shift `expr $OPTIND - 1`
configure_gaia_location "$1"
configure_${mode}_location "$2"
#
# Verify additional dependencies are installed
#
NODE=`which nodejs`
NPM=`which npm`
if [ ! -x "$NODE" ] ; then
NODE=`which node`
if [ ! -x "$NODE" ] ; then
echo "$SELF: Unable to find node; please install node.js."
exit 1
fi
elif [ ! -x "$NPM" ] ; then
echo "$SELF: Unable to find npm; please install npm."
exit 1
fi
cd $GAIADIR
configure_profile_folder
generate_profile_folder_if_needed
prepare_npm_modules
cleanup() {
echo "$SELF: Stopping the test runner on exit."
kill "%1"
}
trap cleanup EXIT
#
# Launch the test agent
#
make test-agent-server &
launch_test_runner_in_${mode}

53
gaia/bin/gaia-ui-tests Executable file
View file

@ -0,0 +1,53 @@
#! /bin/bash -e
export GAIATEST_ACKNOWLEDGED_RISKS=true
export GAIATEST_SKIP_WARNING=true
# Get the mulet binary...
get_mulet_bin() {
local folder=$(find . -d 1 -name 'mulet' | cut -f 1 -d " ")
# Download mulet ...
if [ -z "$folder" ];
then
# Everything goes to stderr...
make mulet 1>&2
fi
find $folder -follow -name "firefox-bin" | tail -n 1
}
# Get the gaia profile...
get_profile() {
# TODO: Make configurable
local folder=profile
if [ ! -d $folder ];
then
# Everything goes to stderr...
make $folder 1>&2
fi
echo $folder
}
mulet=$(get_mulet_bin)
root=tests/python/gaia-ui-tests/gaiatest
profile=$(get_profile)
gaiatest="$root/cli.py"
echo "Using mulet: $mulet"
# Enter the virtual env.
source ./tests/ci/venv.sh &&
# CD into the directory to install python libs.
cd $root/../ && \
# Ensure all dependencies are set.
python setup.py develop && \
# Back to root.
cd $OLDPWD && \
# Run the tests.
python $gaiatest --app=b2gdesktop \
--binary=$mulet \
--profile=$profile \
--type=b2g \
--timeout=10000 \
--restart \
$@