#!/bin/sh
# -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*-
# vim:set noet ts=4:
#
# ibus - The Input Bus
#
# Copyright (c) 2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2021 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

TEST_LOG=
COMMANDS='
id
echo $DISPLAY
pwd
pstree -asp $$
gsettings list-recursively org.gnome.shell
rpm -q gnome-shell-extension-no-overview gnome-shell gnome-session
ps -ef | grep ibus | grep -v grep
ibus address
'

if [ $# -gt 0 ] ; then
    TEST_LOG=$1
fi

run_test()
{
while read cmd ; do
    if [ x"$cmd" = x ] ; then
        continue
    fi
    echo "# $cmd"
    eval "$cmd"
done << EOF_COMMANDS
`echo "$COMMANDS"`
EOF_COMMANDS
}

if [ x"$TEST_LOG" = x ] ; then
    run_test
else
    run_test 2>>$TEST_LOG 1>>$TEST_LOG
fi
