Welcome to mirror list, hosted at ThFree Co, Russian Federation.

run-samples.sh « Samples « System.Drawing « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3f8af55f0cee4ca126f946a6c627c81a510483ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/sh 
################## System.Drawing: run-samples.sh #######################
#                                                                       #
# This script compiles and runs samples from each directory in          #
# System.Drawing.Samples directory. Compiled exes and output            #
# images, if any, are saved to respective directories.                  #
# Compile time logs are saved to compile-log.txt and runtime logs are   #
# saved to runtime-log.txt. Both log files are saved at the same        #
# location where this script is run.                                    #
#                                                                       #
# Following are the two ways to run this script,                        #
#        $ run-samples.sh                                               #
#        OR                                                             #
#        $ run-samples.sh [option]                                      #
#                                                                       #
# NOTE: Possible options are (m)ake, (c)lean, (r)un, (a)ll              #
#        --run is default option, when no option is specified.          #
#          Only one option can be specified at a time.                  #
#        -m, --make - compiles all the samples                          #
#        -c, --clean - deletes all the exes generated                   #
#        -r, --run - compiles and runs all the samples. [Default]       #
#        -a, --all - runs all the samples and also cleans               #
#                                                                       #
# **** This script would hang, if any sample hangs!!!                   #
#                                                                       #
#        Authors:                                                       #
#                Sachin <skumar1@novell.com>                            #
#                Ravindra <rkumar@novell.com>                           #
#                                                                       #
#        Copyright (C) 2004, Novell, Inc. http://www.novell.com         #
#                                                                       #
#########################################################################

# Prints the script usage
print_usage ()
{
    echo "Usage: run-samples [option]"
    echo "Only one option is processed at a time."
    echo "Possible options are: (m)ake, (c)lean, (r)un, (a)ll"
    echo "        -m, --make: Just compiles all the samples."
    echo "        -c, --clean: Just removes all the exes."
    echo "        -r, --run: makes and runs all the samples. [Default]"
    echo "        -a, --all: same as run and clean combined."
    echo "        --run option is assumed, if no option is specified."
    exit 1
}

# Compiles all the samples
compile ()
{
    echo === Compiling samples in $dir ===

    for src in *.cs
      do
      echo " $src"
      echo -n " $src:: " >> $CLOG
      $MCS $COMPILE_OPS $src >> $CLOG 2>&1
    done
}

# Deletes all the exes
clean ()
{
    echo === Cleaning $dir ===
    rm *.exe
}

# Compiles and runs all the samples
run ()
{
    compile
    echo === Running samples in $dir ===
    for exe in *.exe
      do
      echo " $exe"
      echo >> $RLOG
      echo "$dir: $exe :: " >> $RLOG
      echo >> $RLOG
      $MONO $RUN_OPS $exe >> $RLOG 2>&1
    done
}

# Compliles, runs and deletes all the exes
all ()
{
    run
    clean
}

# Environment setup

ROOT=$PWD
CLOG=$ROOT/compile-log.txt
RLOG=$ROOT/runtime-log.txt
MCS=mcs
MONO=mono
LIB=System.Drawing
COMPILE_OPS="-g -r:$LIB"
RUN_OPS=--debug

# Uncomment the following line, if you are running this script on MS
#MSNet=yes

# We don't process more than one command line arguments
if [ $# -gt 1 ]; then
    print_usage
fi

# Default option is run, if no command line argument is present
if [ -z $1 ]; then
    arg=--run
else
    arg=$1
fi

# Creates the log files
echo '*** LOG FILE for compile-time messages for System.Drawing Samples ***' > $CLOG
echo '*** LOG FILE for run-time output messages for System.Drawing Samples ***' > $RLOG

# All directories are processed under Samples.
for dir in `ls -d System.Drawing*`
  do
  echo >> $CLOG
  echo ===== $dir ===== >> $CLOG

  echo >> $RLOG
  echo ===== $dir ===== >> $RLOG

  # Change dir if it exists
  if [ -d $ROOT/$dir ]; then
      cd $ROOT/$dir
      case $arg in
	  "-m") compile ;;
	  "--make") compile ;;
	  "-r") run ;;
	  "--run") run ;;
	  "-a") all ;;
	  "--all") all ;;
	  "-c") clean ;;
	  "--clean") clean ;;
	  *) print_usage ;;
      esac
      cd ..
  else
      echo "$dir not found." >> $CLOG
      echo "$dir not found." >> $RLOG
  fi
done