adjust code generation to make tests bail out early in Miri

This commit is contained in:
Ralf Jung
2020-08-26 11:10:47 +02:00
committed by Henri Sivonen
parent 76c10b756d
commit 9eb726fd6d
2 changed files with 25 additions and 2 deletions
+17
View File
@@ -1446,12 +1446,20 @@ single_byte_file.write("""
#[test]
fn test_single_byte_decode() {""")
idx = 0 # for Miri, return after 2nd test
for name in preferred:
if name == u"ISO-8859-8-I":
continue;
if is_single_byte(name):
single_byte_file.write("""
decode_single_byte(%s, &data::SINGLE_BYTE_DATA.%s);""" % (to_constant_name(name), to_snake_name(name)))
idx += 1
if idx == 2:
single_byte_file.write("""
if cfg!(miri) {
// Miri is too slow
return;
}""")
single_byte_file.write("""
}
@@ -1459,12 +1467,21 @@ single_byte_file.write("""
#[test]
fn test_single_byte_encode() {""")
idx = 0 # for Miri, return after 2nd test
for name in preferred:
if name == u"ISO-8859-8-I":
continue;
if is_single_byte(name):
single_byte_file.write("""
encode_single_byte(%s, &data::SINGLE_BYTE_DATA.%s);""" % (to_constant_name(name), to_snake_name(name)))
idx += 1
if idx == 2:
single_byte_file.write("""
if cfg!(miri) {
// Miri is too slow
return;
}""")
single_byte_file.write("""
+8 -2
View File
@@ -645,7 +645,10 @@ mod tests {
fn test_single_byte_decode() {
decode_single_byte(IBM866, &data::SINGLE_BYTE_DATA.ibm866);
decode_single_byte(ISO_8859_10, &data::SINGLE_BYTE_DATA.iso_8859_10);
if cfg!(miri) { return; } // Miri is too slow
if cfg!(miri) {
// Miri is too slow
return;
}
decode_single_byte(ISO_8859_13, &data::SINGLE_BYTE_DATA.iso_8859_13);
decode_single_byte(ISO_8859_14, &data::SINGLE_BYTE_DATA.iso_8859_14);
decode_single_byte(ISO_8859_15, &data::SINGLE_BYTE_DATA.iso_8859_15);
@@ -677,7 +680,10 @@ mod tests {
fn test_single_byte_encode() {
encode_single_byte(IBM866, &data::SINGLE_BYTE_DATA.ibm866);
encode_single_byte(ISO_8859_10, &data::SINGLE_BYTE_DATA.iso_8859_10);
if cfg!(miri) { return; } // Miri is too slow
if cfg!(miri) {
// Miri is too slow
return;
}
encode_single_byte(ISO_8859_13, &data::SINGLE_BYTE_DATA.iso_8859_13);
encode_single_byte(ISO_8859_14, &data::SINGLE_BYTE_DATA.iso_8859_14);
encode_single_byte(ISO_8859_15, &data::SINGLE_BYTE_DATA.iso_8859_15);