Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile21
-rw-r--r--TODO3
-rw-r--r--scripts/find-free-display.c25
-rwxr-xr-xscripts/run-dogtail-tests11
-rwxr-xr-xscripts/shell/start-sugar3
-rw-r--r--scripts/xinitrc30
-rw-r--r--tests/shell.py2
8 files changed, 65 insertions, 31 deletions
diff --git a/.gitignore b/.gitignore
index e47df0f..ed6ca46 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,5 @@ logs/*.log
logs/*.tar
logs/all-logs.tar.bz2
scripts/list-outputs
+scripts/find-free-display
config
diff --git a/Makefile b/Makefile
index 569f320..399d6fb 100644
--- a/Makefile
+++ b/Makefile
@@ -3,12 +3,7 @@ LOGFILE = $(CURDIR)/logs/build-$(TIMESTAMP).log
SCRIPTS = $(CURDIR)/scripts
JHBUILD = $(CURDIR)/install/bin/jhbuild -f $(SCRIPTS)/jhbuildrc
LOG = $(SCRIPTS)/log-command
-
-ifdef SUGAR_SESSION
-XINITDISPLAY = :100
-else
-XINITDISPLAY = :99
-endif
+XINITDISPLAY = `$(SCRIPTS)/find-free-display`
# The buildbot shell does not handle script properly. It's unnecessary
# anyway because we can't use interactive scripts there.
@@ -25,10 +20,16 @@ submodules:
git submodule update
XRANDR_LIBS = $(shell pkg-config --libs xrandr x11)
+X11_LIBS = $(shell pkg-config --libs x11)
-scripts/list-outputs:
+scripts/list-outputs: scripts/list-outputs.c
gcc -o scripts/list-outputs scripts/list-outputs.c $(XRANDR_LIBS)
+scripts/find-free-display: scripts/find-free-display.c
+ gcc -o scripts/find-free-display scripts/find-free-display.c $(X11_LIBS)
+
+x11-utils: scripts/list-outputs scripts/find-free-display
+
check-system:
$(TYPESCRIPT) $(SCRIPTS)/check-system $(LOGFILE)
@@ -48,13 +49,13 @@ build: build-glucose build-fructose
build-%:
$(TYPESCRIPT) "$(JHBUILD) buildone $*" $(LOGFILE)
-run: scripts/list-outputs
+run: x11-utils
xinit $(SCRIPTS)/xinitrc -- $(XINITDISPLAY) &>>$(LOGFILE)
-test: scripts/list-outputs
+test: x11-utils
$(LOG) "$(SCRIPTS)/run-dogtail-tests" $(LOGFILE)
-shell:
+shell: x11-utils
@cd source; \
PS1="[sugar-build \W]$$ " \
PATH=$(PATH):$(SCRIPTS)/shell \
diff --git a/TODO b/TODO
index 3549345..9993554 100644
--- a/TODO
+++ b/TODO
@@ -1 +1,4 @@
* Figure out what to do with shutdown
+* Improve running sugar under sugar
+* Espeak tracebacks
+* Tests unreliability
diff --git a/scripts/find-free-display.c b/scripts/find-free-display.c
new file mode 100644
index 0000000..4a07131
--- /dev/null
+++ b/scripts/find-free-display.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <X11/extensions/Xrandr.h>
+
+int main(int argc, char **argv)
+{
+ int port;
+
+ for (port = 99; port < 1000; port++) {
+ char display_name[255];
+
+ sprintf(display_name, ":%d", port);
+ Display *dpy = XOpenDisplay(display_name);
+
+ if (!dpy) {
+ printf(display_name);
+ return 0;
+ } else {
+ XCloseDisplay(dpy);
+ }
+ }
+
+ printf("No free display found");
+
+ return 0;
+}
diff --git a/scripts/run-dogtail-tests b/scripts/run-dogtail-tests
index dcef0b8..eeff2ac 100755
--- a/scripts/run-dogtail-tests
+++ b/scripts/run-dogtail-tests
@@ -3,8 +3,9 @@
scriptsdir=`dirname "$0"`
rootdir=`dirname "$scriptsdir"`
testsdir=$rootdir/tests
+scriptsdir=$rootdir/scripts
logsdir=$rootdir/logs
-display=:99
+display=`$scriptsdir/find-free-display`
resolution=1024x768x16
minver="0.8.0"
@@ -23,11 +24,7 @@ fi
export SUGAR_LOGGER_LEVEL=debug
export GTK_MODULES=gail:atk-bridge
-export SUGAR_PROFILE=dogtail
-
-PROFILE_PATH=~/.sugar/dogtail
-
-rm -rf $PROFILE_PATH
+export SUGAR_DOGTAIL=yes
xinit $scriptsdir/xinitrc -- $xserver &
xinitpid=$!
@@ -45,7 +42,7 @@ else
LOGFILE=$logsdir/test.tar
fi
-cd $PROFILE_PATH/logs
+cd ~/.sugar/dogtail/logs
tar cvf $LOGFILE *.log
exit $result
diff --git a/scripts/shell/start-sugar b/scripts/shell/start-sugar
index 86766fa..0bb1b5c 100755
--- a/scripts/shell/start-sugar
+++ b/scripts/shell/start-sugar
@@ -2,5 +2,6 @@
shelldir=`dirname "$0"`
scriptsdir=`dirname "$shelldir"`
+display=`$scriptsdir/find-free-display`
-xinit $scriptsdir/xinitrc -- :99
+xinit $scriptsdir/xinitrc -- $display
diff --git a/scripts/xinitrc b/scripts/xinitrc
index 078d52b..14f5b1f 100644
--- a/scripts/xinitrc
+++ b/scripts/xinitrc
@@ -7,16 +7,24 @@ unset SESSION_MANAGER
SCRIPTS_DIR=`dirname "$0"`
ROOT_DIR=`dirname "$SCRIPTS_DIR"`
-if [ -f $ROOT_DIR/config ]; then
- source $ROOT_DIR/config
+if [ ! -f $ROOT_DIR/config ]; then
+ touch $ROOT_DIR/config
fi
-echo $OUTPUT
+if [ ! -z $SUGAR_PROFILE ]; then
+ grep -q PROFILE $ROOT_DIR/config
+ if [ $? -eq 1 ]; then
+ randomstring=`</dev/urandom tr -cd A-Za-z0-9 | head -c10`
+ echo "PROFILE=$randomstring" >> $ROOT_DIR/config
+ fi
+fi
+
+source $ROOT_DIR/config
# Sugar doesn't handle multiple outputs properly. To avoid issues we keep the
# first output in the list returned by xrandr and turn off everything else.
-OUTPUTS=`scripts/list-outputs`
+OUTPUTS=`$SCRIPTS_DIR/list-outputs`
for output in $OUTPUTS
do
@@ -30,14 +38,12 @@ do
fi
done
-if [ ! -z $RESOLUTION ]; then
- xrandr -s $RESOLUTION
-fi
-
-if [ -z $SUGAR_SESSION ]; then
- export SUGAR_SESSION=yes
-else
- export SUGAR_PROFILE=development
+echo $SUGAR_DOGTAIL
+if [ ! -z $SUGAR_DOGTAIL ]; then
+ rm -rf ~/.sugar/dogtail
+ export SUGAR_PROFILE=dogtail
+elif [ ! -z $PROFILE ]; then
+ export SUGAR_PROFILE=$PROFILE
fi
eval `ssh-agent -s`
diff --git a/tests/shell.py b/tests/shell.py
index 1e00b97..d606783 100644
--- a/tests/shell.py
+++ b/tests/shell.py
@@ -68,8 +68,8 @@ def main():
go_to_list_view()
for activity in build_activities_list():
- launch_and_stop_activity(activity)
sleep(10)
+ launch_and_stop_activity(activity)
try:
main()