@@ -381,3 +381,118 @@ impl core::fmt::Display for Abi {
381
381
)
382
382
}
383
383
}
384
+
385
+ #[ cfg( test) ]
386
+ mod test {
387
+ use super :: * ;
388
+
389
+ #[ test]
390
+ fn armv4t_none_eabi ( ) {
391
+ let target = "armv4t-none-eabi" ;
392
+ let target_info = process_target ( target) ;
393
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: A32 ) ) ;
394
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv4T ) ) ;
395
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: Legacy ) ) ;
396
+ assert_eq ! ( target_info. abi( ) , Some ( Abi :: Eabi ) ) ;
397
+ }
398
+
399
+ #[ test]
400
+ fn armv5te_none_eabi ( ) {
401
+ let target = "armv5te-none-eabi" ;
402
+ let target_info = process_target ( target) ;
403
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: A32 ) ) ;
404
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv5TE ) ) ;
405
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: Legacy ) ) ;
406
+ assert_eq ! ( target_info. abi( ) , Some ( Abi :: Eabi ) ) ;
407
+ }
408
+
409
+ #[ test]
410
+ fn thumbv6m_none_eabi ( ) {
411
+ let target = "thumbv6m-none-eabi" ;
412
+ let target_info = process_target ( target) ;
413
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: T32 ) ) ;
414
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv6M ) ) ;
415
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: M ) ) ;
416
+ assert_eq ! ( target_info. abi( ) , Some ( Abi :: Eabi ) ) ;
417
+ }
418
+
419
+ #[ test]
420
+ fn thumbv7m_none_eabi ( ) {
421
+ let target = "thumbv7m-none-eabi" ;
422
+ let target_info = process_target ( target) ;
423
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: T32 ) ) ;
424
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv7M ) ) ;
425
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: M ) ) ;
426
+ assert_eq ! ( target_info. abi( ) , Some ( Abi :: Eabi ) ) ;
427
+ }
428
+
429
+ #[ test]
430
+ fn thumbv7em_nuttx_eabihf ( ) {
431
+ let target = "thumbv7em-nuttx-eabihf" ;
432
+ let target_info = process_target ( target) ;
433
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: T32 ) ) ;
434
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv7EM ) ) ;
435
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: M ) ) ;
436
+ assert_eq ! ( target_info. abi( ) , Some ( Abi :: EabiHf ) ) ;
437
+ }
438
+
439
+ #[ test]
440
+ fn thumbv8m_base_none_eabi ( ) {
441
+ let target = "thumbv8m.base-none-eabi" ;
442
+ let target_info = process_target ( target) ;
443
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: T32 ) ) ;
444
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv8MBase ) ) ;
445
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: M ) ) ;
446
+ assert_eq ! ( target_info. abi( ) , Some ( Abi :: Eabi ) ) ;
447
+ }
448
+
449
+ #[ test]
450
+ fn thumbv8m_main_none_eabihf ( ) {
451
+ let target = "thumbv8m.main-none-eabihf" ;
452
+ let target_info = process_target ( target) ;
453
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: T32 ) ) ;
454
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv8MMain ) ) ;
455
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: M ) ) ;
456
+ assert_eq ! ( target_info. abi( ) , Some ( Abi :: EabiHf ) ) ;
457
+ }
458
+
459
+ #[ test]
460
+ fn armv7r_none_eabi ( ) {
461
+ let target = "armv7r-none-eabi" ;
462
+ let target_info = process_target ( target) ;
463
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: A32 ) ) ;
464
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv7R ) ) ;
465
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: R ) ) ;
466
+ assert_eq ! ( target_info. abi( ) , Some ( Abi :: Eabi ) ) ;
467
+ }
468
+
469
+ #[ test]
470
+ fn armv8r_none_eabihf ( ) {
471
+ let target = "armv8r-none-eabihf" ;
472
+ let target_info = process_target ( target) ;
473
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: A32 ) ) ;
474
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv8R ) ) ;
475
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: R ) ) ;
476
+ assert_eq ! ( target_info. abi( ) , Some ( Abi :: EabiHf ) ) ;
477
+ }
478
+
479
+ #[ test]
480
+ fn armv7a_none_eabi ( ) {
481
+ let target = "armv7a-none-eabi" ;
482
+ let target_info = process_target ( target) ;
483
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: A32 ) ) ;
484
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv7A ) ) ;
485
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: A ) ) ;
486
+ assert_eq ! ( target_info. abi( ) , Some ( Abi :: Eabi ) ) ;
487
+ }
488
+
489
+ #[ test]
490
+ fn aarch64_none_eabihf ( ) {
491
+ let target = "aarch64-unknown-none" ;
492
+ let target_info = process_target ( target) ;
493
+ assert_eq ! ( target_info. isa( ) , Some ( Isa :: A64 ) ) ;
494
+ assert_eq ! ( target_info. arch( ) , Some ( Arch :: Armv8A ) ) ;
495
+ assert_eq ! ( target_info. profile( ) , Some ( Profile :: A ) ) ;
496
+ assert_eq ! ( target_info. abi( ) , None ) ;
497
+ }
498
+ }
0 commit comments