summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-10 14:59:03 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-10 14:59:03 +0000
commit12b2266af600824b8460918bd694233b07dd3f67 (patch)
tree565cfbb286832550c168bf426ddaad6fbe1e11e8
parent19e0c8f9177d08402ebaa4e5c05e6a523e3b455f (diff)
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile: Add new tests. Most of these eitehr demonstrate or verify a particular functionality. * cpuuse/Makefile, cpuuse/cpuuse.adb, exception_test2/Makefile, exception_test2/exceptiontest2.adb, exception_test3/Makefile, exception_test3/exceptiontest3.adb: New files.
-rw-r--r--ChangeLog8
-rw-r--r--Makefile6
-rw-r--r--cpuuse/Makefile21
-rw-r--r--cpuuse/cpuuse.adb58
-rw-r--r--exception_test2/Makefile23
-rw-r--r--exception_test2/exceptiontest2.adb25
-rw-r--r--exception_test3/Makefile23
-rw-r--r--exception_test3/exceptiontest3.adb27
8 files changed, 190 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f843eb..5ef17f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * Makefile: Add new tests. Most of these eitehr demonstrate or verify a
+ particular functionality.
+ * cpuuse/Makefile, cpuuse/cpuuse.adb, exception_test2/Makefile,
+ exception_test2/exceptiontest2.adb, exception_test3/Makefile,
+ exception_test3/exceptiontest3.adb: New files.
+
2008-08-25 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.shared: (pc386) Make sure .exe is file to run.
diff --git a/Makefile b/Makefile
index 8cda0e8..d519e6f 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,11 @@ include $(RTEMS_CUSTOM)
include $(RTEMS_ROOT)/make/directory.cfg
SUBDIRS=empty hello_world_ada hello_via_task delay_until stack_check \
- task_priority exception_test ada_from_c_task
+ task_priority ada_from_c_task
+
+# If you want to test exceptions
+EXCEPTION_TESTS=exception_test exception_test2 exception_test3
+SUBDIRS += $(EXCEPTION_TESTS)
ifeq ($(RTEMS_BSP),erc32)
SUBDIRS += irq_test irq_test_c
diff --git a/cpuuse/Makefile b/cpuuse/Makefile
new file mode 100644
index 0000000..e00b2a4
--- /dev/null
+++ b/cpuuse/Makefile
@@ -0,0 +1,21 @@
+#
+# Makefile for Ada Dump URL example
+#
+# See README.Makefiles in the main ada-examples directory.
+#
+
+PROGRAM=cpuuse
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+# stack size for the first Ada thread
+CFLAGS +=-DGNAT_MAIN_STACKSPACE=100
+
+EXTRA_OBJS =
+EXTRA_GNATFLAGS=-fstack-check
+
+include ../Makefile.shared
+
+empty.o: empty.c
diff --git a/cpuuse/cpuuse.adb b/cpuuse/cpuuse.adb
new file mode 100644
index 0000000..5683afa
--- /dev/null
+++ b/cpuuse/cpuuse.adb
@@ -0,0 +1,58 @@
+--
+-- Demonstrate CPU Usage Report
+--
+-- $Id$
+--
+
+
+with Text_IO; use Text_IO;
+with Ada.Dynamic_Priorities; use Ada.Dynamic_Priorities;
+with System;
+with Interfaces.C;
+with RTEMS;
+
+procedure CPUUSE is
+
+ task Low_Task is
+ pragma Priority(16);
+ end Low_Task;
+
+ task High_Task is
+ pragma Priority(17);
+ end High_Task;
+
+ task body High_Task is
+ Seconds : Integer;
+ Result : RTEMS.Status_Codes;
+ begin
+ RTEMS.Object_Set_Name( RTEMS.Self, "High_Task", Result );
+ Seconds := 0;
+ loop
+ delay 1.0;
+ Seconds := Seconds + 1;
+ Put_Line ("High - waking up at " & Integer'Image(Seconds));
+ if (Seconds mod 5) = 0 then
+ RTEMS.CPU_Usage_Report;
+ end if;
+ if Seconds = 30 then
+ Put_Line ("*** End of Ada CPU Use Test ***");
+ RTEMS.Shutdown_Executive (0);
+ end if;
+ end loop;
+ end High_Task;
+
+ task body Low_Task is
+ Result : RTEMS.Status_Codes;
+ begin
+ RTEMS.Object_Set_Name( RTEMS.Self, "Low_Task", Result );
+ delay 0.1;
+ loop
+ Null;
+ end loop;
+ end Low_Task;
+
+ Result : RTEMS.Status_Codes;
+begin
+ RTEMS.Object_Set_Name( RTEMS.Self, "Ada Main", Result );
+ Put_Line ("*** Start of Ada CPU Use Test ***");
+end CPUUSE;
diff --git a/exception_test2/Makefile b/exception_test2/Makefile
new file mode 100644
index 0000000..faa9f1d
--- /dev/null
+++ b/exception_test2/Makefile
@@ -0,0 +1,23 @@
+#
+# See README.Makefiles in the main ada-examples directory.
+#
+
+PROGRAM=exceptiontest2
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+# stack size for the first Ada thread
+CFLAGS +=-DGNAT_MAIN_STACKSPACE=100
+
+# initialize the network stack -- assumes existence of networkconfig.h
+# CFLAGS +=-DMAIN_USE_NETWORKING=1
+
+# Should we prompt for command line arguments?
+# DEFINES +=-DMAIN_USE_REQUIRES_COMMAND_LINE
+
+# If you want to hard-code the command line, define this to a string
+# DEFINES += -DMAIN_COMMAND_LINE="ARGS"
+
+include ../Makefile.shared
diff --git a/exception_test2/exceptiontest2.adb b/exception_test2/exceptiontest2.adb
new file mode 100644
index 0000000..822ee1a
--- /dev/null
+++ b/exception_test2/exceptiontest2.adb
@@ -0,0 +1,25 @@
+--BEGIN exceptiontest2.adb
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure ExceptionTest2 is
+ function F return Boolean is
+ begin
+ raise Constraint_Error;
+ return True;
+ end F;
+begin
+ begin
+ if F then
+ Put_Line ("Not ok");
+ else
+ Put_Line ("Not ok and bad value");
+ end if;
+ exception
+ when others =>
+ Put_Line ("Caught Constraint_Error -- inner");
+ end;
+exception
+ when others =>
+ Put_Line ("Caught Constraint_Error -- outer -- not OK");
+end ExceptionTest2;
+--END exceptiontest2.adb
diff --git a/exception_test3/Makefile b/exception_test3/Makefile
new file mode 100644
index 0000000..9eb4917
--- /dev/null
+++ b/exception_test3/Makefile
@@ -0,0 +1,23 @@
+#
+# See README.Makefiles in the main ada-examples directory.
+#
+
+PROGRAM=exceptiontest3
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+# stack size for the first Ada thread
+CFLAGS +=-DGNAT_MAIN_STACKSPACE=100
+
+# initialize the network stack -- assumes existence of networkconfig.h
+# CFLAGS +=-DMAIN_USE_NETWORKING=1
+
+# Should we prompt for command line arguments?
+# DEFINES +=-DMAIN_USE_REQUIRES_COMMAND_LINE
+
+# If you want to hard-code the command line, define this to a string
+# DEFINES += -DMAIN_COMMAND_LINE="ARGS"
+
+include ../Makefile.shared
diff --git a/exception_test3/exceptiontest3.adb b/exception_test3/exceptiontest3.adb
new file mode 100644
index 0000000..be4bd1b
--- /dev/null
+++ b/exception_test3/exceptiontest3.adb
@@ -0,0 +1,27 @@
+--BEGIN exceptiontest3.adb
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure ExceptionTest3 is
+ function F return Boolean is
+ begin
+ raise Constraint_Error;
+ return True;
+ end F;
+begin
+ begin
+ if F then
+ Put_Line ("Not ok");
+ else
+ Put_Line ("Not ok and bad value");
+ end if;
+ exception
+ when Constraint_Error =>
+ Put_Line ("Caught Constraint_Error -- inner");
+ when others =>
+ Put_Line ("not ok wrong exception");
+ end;
+exception
+ when others =>
+ Put_Line ("Caught Constraint_Error -- outer -- not OK");
+end ExceptionTest3;
+--END exceptiontest3.adb