From 04064f05edc360c3fc8e1d441adddeb646331dbd Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 14 Mar 2016 16:55:24 -0400 Subject: [PATCH] Fix: config: check for unknown "base" values in int type object Signed-off-by: Philippe Proulx --- README.md | 4 ++-- barectf/config.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e4c9e59..669e0ff 100644 --- a/README.md +++ b/README.md @@ -665,7 +665,7 @@ A CTF integer type. | `size` | Integer (positive) | Size (bits) (1 to 64) | Required | N/A | | `align` | Integer (positive) | Alignment (bits) (power of two) | Optional | 8 if `size` property is a multiple of 8, else 1 | | `signed` | Boolean | Signedness | Optional | `false` (unsigned) | -| `base` | Integer | Display radix (2, 8, 10, or 16) | Optional | 10 | +| `base` | Integer | Display radix (`bin`, `oct`, `dec`, or `hex`) | Optional | `dec` | | `byte-order` | String | Byte order (`le` for little-endian, `be` for big-endian, or `native` to use the byte order defined at the trace level) | Optional | `native` | | `property-mappings` | Array of [property mapping objects](#property-mapping-object) | Property mappings of this integer type | Optional | N/A | @@ -677,7 +677,7 @@ The `property-mappings` array property currently accepts only one element. class: int size: 12 signed: false -base: 8 +base: oct byte-order: le property-mappings: - type: clock diff --git a/barectf/config.py b/barectf/config.py index 22038eb..e3b27af 100644 --- a/barectf/config.py +++ b/barectf/config.py @@ -1304,6 +1304,8 @@ class _YamlConfigParser: base = 10 elif base == 'hex': base = 16 + else: + raise ConfigError('unknown "base" property value: "{}" ("bin", "oct", "dec", and "hex" are accepted)'.format(base)) obj.base = base -- 2.34.1