]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Convert cmetric test to a single file
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 12 Nov 2013 13:59:57 +0000 (14:59 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 12 Nov 2013 15:27:53 +0000 (16:27 +0100)
tests/cmetric
tests/cmetric.files [deleted file]

index 8049fc7b761e19da6ff1ab13dd210a8e12404ad7..28c993f72447f9c02382a699fa92eee4a248773e 100755 (executable)
@@ -1,6 +1,136 @@
 #!/bin/bash
 
-. ./functions.sh
+. ./wvtest.sh
+
+cat > 'correct_cmetric_config.h' <<EOF
+/* Automatically generated from for_cmetric_config.o */
+/* Conditionals to control compilation */
+/* Defines from the values defined to symbols in hexadecimal format */
+#define FLAG_BAR_b 0x01
+#define FLAG_BAR_m 0x02
+#define FLAG_FOO_b 0x0
+#define FLAG_FOO_m 0x01
+#define VALUE_HEX 0x07b
+#define o_blah_field1 0x0
+#define o_blah_field2 0x04
+#define o_blah_flags 0x08
+#define s_blah_field1 0x04
+#define s_blah_field2 0x01
+#define s_blah_flags 0x04
+/* Defines from the values defined to symbols in decimal format */
+#define VALUE_DEC 123
+#define VALUE_DEC_ZERO 0
+EOF
+cat > 'Makefile.omk' <<EOF
+# -*- makefile -*-
+
+NM=nm
+
+cmetric_include_HEADERS = test/cmetric_config.h
+cmetric_config_CMETRIC_SOURCES = for_cmetric_config.c
+
+bin_PROGRAMS = test
+test_SOURCES = test.S
+EOF
+cat > 'for_cmetric_config.c' <<EOF
+/* Export of offset information to assembly source code */
+
+/* %N (for N a digit) means print operand N in usual manner.
+   %lN label name with no punctuation
+   %cN constant expression with no punctuation
+   %aN means expect operand N to be a memory address
+       (not a memory reference!) and print a reference
+       to that address.
+   %nN constant expression for minus the value with no other punctuation.
+ */
+
+#include "header.h"
+
+#define NUM2ASM(sym,val) \
+    __asm__ ( \
+       ".set " #sym ",%c0\n" \
+       ".global " #sym "\n" \
+       ::"n"(val) \
+    )
+
+#define FIELD2ASM(strct, fld)                             \
+       NUM2ASM(_cmetric2def_o_##strct##_##fld,&((struct strct*)0L)->fld); \
+       NUM2ASM(_cmetric2def_s_##strct##_##fld,sizeof(((struct strct*)0L)->fld))
+
+#define MASKBIT2ASM(def_base) \
+       NUM2ASM(_cmetric2def_##def_base##_b,def_base##_b); \
+       NUM2ASM(_cmetric2def_##def_base##_m,def_base##_m)
+
+#define VALUE2ASM(value_name,value) \
+       NUM2ASM(_cmetric2def_##value_name,value)
+
+#define DEC_VALUE2ASM(value_name,value) \
+       NUM2ASM(_cmetric2defdec_##value_name,value)
+
+void pxmc_public2asm(void)
+{
+
+#ifdef CONFIG_TEST_OPTION1
+VALUE2ASM(CMETRIC_TEST_OPTION1,1);
+#endif
+#ifdef CONFIG_TEST_OPTION2
+VALUE2ASM(CMETRIC_TEST_OPTION2,1);
+#endif
+#ifdef CONFIG_TEST_OPTION3
+VALUE2ASM(CMETRIC_TEST_OPTION3,1);
+#endif
+#ifdef CONFIG_TEST_OPTION4
+VALUE2ASM(CMETRIC_TEST_OPTION4,1);
+#endif
+#ifdef CONFIG_TEST_OPTION5
+VALUE2ASM(CMETRIC_TEST_OPTION5,1);
+#endif
+#ifdef CONFIG_TEST_OPTION6
+VALUE2ASM(CMETRIC_TEST_OPTION6,1);
+#endif
+
+VALUE2ASM(VALUE_HEX, 123);
+DEC_VALUE2ASM(VALUE_DEC, 123);
+DEC_VALUE2ASM(VALUE_DEC_ZERO, 0);
+
+MASKBIT2ASM(FLAG_FOO);
+MASKBIT2ASM(FLAG_BAR);
+
+FIELD2ASM(blah, field1);
+FIELD2ASM(blah, field2);
+FIELD2ASM(blah, flags);
+
+}
+EOF
+cat > 'test.S' <<EOF
+#include <test/cmetric_config.h>
+
+/*
+ * In this file, we can use the symbols extracted from .o generated by
+ * a C compiler
+ */
+
+.global main
+main:
+EOF
+cat > 'header.h' <<EOF
+#ifndef HEADER_H
+#define HEADER_H
+
+#define FLAG_FOO_b 0
+#define FLAG_FOO_m (1<<FLAG_FOO_b)
+#define FLAG_BAR_b 1
+#define FLAG_BAR_m (1<<FLAG_BAR_b)
+
+struct blah {
+       int field1;
+       char field2;
+       int flags;
+};
+
+#endif
+EOF
+
 
 touch config.omk-default
 needs_valid_CC
diff --git a/tests/cmetric.files b/tests/cmetric.files
deleted file mode 100644 (file)
index 47fd437..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-cat > 'correct_cmetric_config.h' <<EOF
-/* Automatically generated from for_cmetric_config.o */
-/* Conditionals to control compilation */
-/* Defines from the values defined to symbols in hexadecimal format */
-#define FLAG_BAR_b 0x01
-#define FLAG_BAR_m 0x02
-#define FLAG_FOO_b 0x0
-#define FLAG_FOO_m 0x01
-#define VALUE_HEX 0x07b
-#define o_blah_field1 0x0
-#define o_blah_field2 0x04
-#define o_blah_flags 0x08
-#define s_blah_field1 0x04
-#define s_blah_field2 0x01
-#define s_blah_flags 0x04
-/* Defines from the values defined to symbols in decimal format */
-#define VALUE_DEC 123
-#define VALUE_DEC_ZERO 0
-EOF
-cat > 'Makefile.omk' <<EOF
-# -*- makefile -*-
-
-NM=nm
-
-cmetric_include_HEADERS = test/cmetric_config.h
-cmetric_config_CMETRIC_SOURCES = for_cmetric_config.c
-
-bin_PROGRAMS = test
-test_SOURCES = test.S
-EOF
-cat > 'for_cmetric_config.c' <<EOF
-/* Export of offset information to assembly source code */
-
-/* %N (for N a digit) means print operand N in usual manner.
-   %lN label name with no punctuation
-   %cN constant expression with no punctuation
-   %aN means expect operand N to be a memory address
-       (not a memory reference!) and print a reference
-       to that address.
-   %nN constant expression for minus the value with no other punctuation. 
- */
-
-#include "header.h"
-
-#define NUM2ASM(sym,val) \
-    __asm__ ( \
-       ".set " #sym ",%c0\n" \
-       ".global " #sym "\n" \
-       ::"n"(val) \
-    )
-
-#define FIELD2ASM(strct, fld)                             \
-       NUM2ASM(_cmetric2def_o_##strct##_##fld,&((struct strct*)0L)->fld); \
-       NUM2ASM(_cmetric2def_s_##strct##_##fld,sizeof(((struct strct*)0L)->fld))
-
-#define MASKBIT2ASM(def_base) \
-       NUM2ASM(_cmetric2def_##def_base##_b,def_base##_b); \
-       NUM2ASM(_cmetric2def_##def_base##_m,def_base##_m)
-
-#define VALUE2ASM(value_name,value) \
-       NUM2ASM(_cmetric2def_##value_name,value)
-
-#define DEC_VALUE2ASM(value_name,value) \
-       NUM2ASM(_cmetric2defdec_##value_name,value)
-
-void pxmc_public2asm(void)
-{
-
-#ifdef CONFIG_TEST_OPTION1
-VALUE2ASM(CMETRIC_TEST_OPTION1,1);
-#endif
-#ifdef CONFIG_TEST_OPTION2
-VALUE2ASM(CMETRIC_TEST_OPTION2,1);
-#endif
-#ifdef CONFIG_TEST_OPTION3
-VALUE2ASM(CMETRIC_TEST_OPTION3,1);
-#endif
-#ifdef CONFIG_TEST_OPTION4
-VALUE2ASM(CMETRIC_TEST_OPTION4,1);
-#endif
-#ifdef CONFIG_TEST_OPTION5
-VALUE2ASM(CMETRIC_TEST_OPTION5,1);
-#endif
-#ifdef CONFIG_TEST_OPTION6
-VALUE2ASM(CMETRIC_TEST_OPTION6,1);
-#endif
-
-VALUE2ASM(VALUE_HEX, 123);
-DEC_VALUE2ASM(VALUE_DEC, 123);
-DEC_VALUE2ASM(VALUE_DEC_ZERO, 0);
-
-MASKBIT2ASM(FLAG_FOO);
-MASKBIT2ASM(FLAG_BAR);
-
-FIELD2ASM(blah, field1);
-FIELD2ASM(blah, field2);
-FIELD2ASM(blah, flags);
-
-}
-EOF
-cat > 'test.S' <<EOF
-#include <test/cmetric_config.h>
-
-/*
- * In this file, we can use the symbols extracted from .o generated by
- * a C compiler
- */
-
-.global main
-main:
-EOF
-cat > 'header.h' <<EOF
-#ifndef HEADER_H
-#define HEADER_H
-
-#define FLAG_FOO_b 0
-#define FLAG_FOO_m (1<<FLAG_FOO_b)
-#define FLAG_BAR_b 1
-#define FLAG_BAR_m (1<<FLAG_BAR_b)
-
-struct blah {
-       int field1;
-       char field2;
-       int flags;
-};
-
-#endif
-EOF