[PATCH] int64 operation test.
Sam Price
thesamprice at gmail.com
Wed Oct 11 15:28:55 UTC 2023
on microblaze there is an operation that destroys the msr on interrupt
task switches.
(addi needs switched to addik).
I was trying to add a single processor 78 test to detect this, could
someone review?
*** BEGIN OF TEST SP 78 ***
*** TEST VERSION: 6.0.0.227fd7cbb84a286983ec2b4cea3a24b9836692cb
*** TEST STATE: EXPECTED_PASS
*** TEST BUILD: RTEMS_POSIX_API
*** TEST TOOLS: 10.5.0 20230707 (RTEMS 6, RSB
2c95b275714ff8d90bc16ef30ab861ecb54ef0a8-modified, Newlib a021448)
Mod64 failed pos 1831 16 != -4294967280
mod64_failed FAILED -- expected (RTEMS_SUCCESSFUL) got (?)
[ RTEMS shutdown ]
RTEMS version: 6.0.0.227fd7cbb84a286983ec2b4cea3a24b9836692cb
RTEMS tools: 10.5.0 20230707 (RTEMS 6, RSB
2c95b275714ff8d90bc16ef30ab861ecb54ef0a8-modified, Newlib a021448)
executing thread ID: 0x0a010001
executing thread name: UI1
if i patch addi with addik
*** BEGIN OF TEST SP 78 ***
*** TEST VERSION: 6.0.0.227fd7cbb84a286983ec2b4cea3a24b9836692cb
*** TEST STATE: EXPECTED_PASS
*** TEST BUILD: RTEMS_POSIX_API
*** TEST TOOLS: 10.5.0 20230707 (RTEMS 6, RSB
2c95b275714ff8d90bc16ef30ab861ecb54ef0a8-modified, Newlib a021448)
*** END OF TEST SP 78 ***
[ RTEMS shutdown ]
RTEMS version: 6.0.0.227fd7cbb84a286983ec2b4cea3a24b9836692cb
RTEMS tools: 10.5.0 20230707 (RTEMS 6, RSB
2c95b275714ff8d90bc16ef30ab861ecb54ef0a8-modified, Newlib a021448)
executing thread ID: 0x0a010001
executing thread name: UI1
---
spec/build/testsuites/sptests/grp.yml | 2 +
testsuites/sptests/sp78/init.c | 106 ++++++++++++++++++++++++++
testsuites/sptests/sp78/sp78.doc | 37 +++++++++
testsuites/sptests/sp78/sp78.scn | 2 +
4 files changed, 147 insertions(+)
create mode 100644 testsuites/sptests/sp78/init.c
create mode 100644 testsuites/sptests/sp78/sp78.doc
create mode 100644 testsuites/sptests/sp78/sp78.scn
diff --git a/spec/build/testsuites/sptests/grp.yml
b/spec/build/testsuites/sptests/grp.yml
index 7676f2cb36..bc5b0fddf1 100644
--- a/spec/build/testsuites/sptests/grp.yml
+++ b/spec/build/testsuites/sptests/grp.yml
@@ -164,6 +164,8 @@ links:
uid: sp76
- role: build-dependency
uid: sp77
+- role: build-dependency
+ uid: sp78
- role: build-dependency
uid: spassoc01
- role: build-dependency
diff --git a/testsuites/sptests/sp78/init.c b/testsuites/sptests/sp78/init.c
new file mode 100644
index 0000000000..03254ae175
--- /dev/null
+++ b/testsuites/sptests/sp78/init.c
@@ -0,0 +1,106 @@
+/*
+ * COPYRIGHT (c) 2012.
+ * Krzysztof Miesowicz <krzysztof.miesowicz at gmail.com>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+
+#define STRESS_COUNT 100000
+#define TEST_OFFSET 0x1b3d70 // Some arbitrary offset
+
+typedef struct test_data_container{
+ int64_t divide[STRESS_COUNT];
+ int64_t mod[STRESS_COUNT];
+ int64_t mul[STRESS_COUNT];
+}test_data_container;
+
+test_data_container truth_data;
+test_data_container test_data;
+
+const char rtems_test_name[] = "SP 78";
+
+/* forward declarations to avoid warnings */
+rtems_task Init(rtems_task_argument argument);
+void build_test_data(test_data_container * data);
+void check_test_data(test_data_container * truth, test_data_container * data);
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ TEST_BEGIN();
+
+ int lcv; /* Loop control variable */
+ rtems_interrupt_lock_context lock_contex;
+ // rtems_interrupt_lock interrupt_lock;
+
+ /* Lock interrupts to create truth data */
+ rtems_interrupt_lock_acquire(interrupt_lock, &lock_contex);
+ build_test_data(&truth_data);
+ rtems_interrupt_lock_release(interrupt_lock, &lock_contex);
+ for(lcv=0;lcv<10;lcv++){
+ build_test_data(&test_data);
+ check_test_data(&truth_data, &test_data);
+ }
+
+ TEST_END();
+
+ rtems_test_exit(0);
+}
+
+void build_test_data(test_data_container * data){
+ volatile int64_t size;
+ volatile int64_t div_check;
+ volatile int64_t mod_check;
+ volatile int64_t mul_check;
+ for (int i = 0; i < STRESS_COUNT; i++) {
+ size = TEST_OFFSET*i;
+
+ div_check = size / 128;
+ mod_check = size % 128;
+ mul_check = size * 128;
+
+ data->divide[i] = div_check;
+ data->mod[i] = mod_check;
+ data->mul[i] = mul_check;
+ }
+}
+void check_test_data(test_data_container * truth, test_data_container * data){
+ for (int i = 0; i < STRESS_COUNT; i++) {
+ if( truth->divide[i] != data->divide[i]){
+ printf( "Divide64 failed pos %i %lld != %lld\n", i,
truth->divide[i], data->divide[i] );
+ directive_failed( -1, "divide64_failed" );
+ }
+ if( truth->mod[i] != data->mod[i]){
+ printf( "Mod64 failed pos %i %lld != %lld\n", i,
truth->mod[i], data->mod[i] );
+ directive_failed( -1, "mod64_failed" );
+ }
+ if( truth->mul[i] != data->mul[i]){
+ printf( "Mul64 failed pos %i %lld != %lld\n", i,
truth->mul[i], data->mul[i] );
+ directive_failed( -1, "mul64_failed" );
+
+ }
+ }
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+/* Increase clock rate to force interrupts to occur */
+#define CONFIGURE_MICROSECONDS_PER_TICK (100)
+
+
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/sptests/sp78/sp78.doc b/testsuites/sptests/sp78/sp78.doc
new file mode 100644
index 0000000000..339eea3b5f
--- /dev/null
+++ b/testsuites/sptests/sp78/sp78.doc
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: BSD-2-Clause
+
+# COPYRIGHT (c) 2012.
+# Krzysztof Miesowicz <krzysztof.miesowicz at gmail.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: sp78
+
+directives:
+
+concepts:
+
++ test to check if integer64 operations work, and are not corrupted
by isr routines.
+Interrupt rates are set very high. to force interrupts while int64
operations are being done.
diff --git a/testsuites/sptests/sp78/sp78.scn b/testsuites/sptests/sp78/sp78.scn
new file mode 100644
index 0000000000..e7958020ad
--- /dev/null
+++ b/testsuites/sptests/sp78/sp78.scn
@@ -0,0 +1,2 @@
+*** TEST sp78 ***
+*** END OF TEST sp78 ***
--
2.42.0
More information about the devel
mailing list