summary refs log tree commit diff stats
path: root/tests/pragmas/tbitsize.nim
Commit message (Expand)AuthorAgeFilesLines
* ensure generated c-code matchesAman Gupta2015-09-301-0/+4
* better assertions for bitfield behaviorAman Gupta2015-09-291-3/+14
* implement bitsize pragma for bitfieldsAman Gupta2015-09-281-0/+7
4ab9bc4159d3f20c345'>^
20b5f31c0 ^



a5f1abc5c ^
20b5f31c0 ^

a5f1abc5c ^

20b5f31c0 ^
d29aa4c5a ^
20b5f31c0 ^



a5f1abc5c ^
20b5f31c0 ^
a5f1abc5c ^
f1d165adf ^
20b5f31c0 ^
f1d165adf ^
31bb67a30 ^
20b5f31c0 ^


a5f1abc5c ^
20b5f31c0 ^
a5f1abc5c ^
fc452787e ^
f1d165adf ^

a5f1abc5c ^

e80465dac ^
a5f1abc5c ^



20b5f31c0 ^
a22bf14bb ^
a5f1abc5c ^










a22bf14bb ^
a5f1abc5c ^




20b5f31c0 ^

a5f1abc5c ^

20b5f31c0 ^
a5f1abc5c ^
fa02ffaeb ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

 
                             
                                         



                                       
                                 

    

                              
 
                                           



                        
                    
 
                               
                                          
                   
                                                  
                                       


                                            
                          
 
                            
                               

                                                                   

                                                                           
 



                         
 
                                                                                        










                                                                       
                                                                             




                                                                                     

              

                            
 
               


                             
#
#
#              The Nim Tester
#        (c) Copyright 2017 Andreas Rumpf
#
#    Look at license.txt for more info.
#    All rights reserved.

import strutils, os, osproc, json

type
  MachineId* = distinct string
  CommitId = distinct string

proc `$`*(id: MachineId): string {.borrow.}

var
  thisMachine: MachineId
  thisCommit: CommitId
  thisBranch: string

proc getMachine*(): MachineId =
  var name = execProcess("hostname").strip
  if name.len == 0:
    name = when defined(posix): getEnv("HOSTNAME")
           else: getEnv("COMPUTERNAME")
  if name.len == 0:
    quit "cannot determine the machine name"

  result = MachineId(name)

proc getCommit(): CommitId =
  const commLen = "commit ".len
  let hash = execProcess("git log -n 1").strip[commLen..commLen+10]
  thisBranch = execProcess("git symbolic-ref --short HEAD").strip
  if hash.len == 0 or thisBranch.len == 0: quit "cannot determine git HEAD"
  result = CommitId(hash)

var
  results: File
  currentCategory: string
  entries: int

proc writeTestResult*(name, category, target, action, result, expected, given: string) =
  createDir("testresults")
  if currentCategory != category:
    if currentCategory.len > 0:
      results.writeLine("]")
      close(results)
    currentCategory = category
    results = open("testresults" / category.addFileExt"json", fmWrite)
    results.writeLine("[")
    entries = 0

  let jentry = %*{"name": name, "category": category, "target": target,
    "action": action, "result": result, "expected": expected, "given": given,
    "machine": thisMachine.string, "commit": thisCommit.string, "branch": thisBranch}
  if entries > 0:
    results.writeLine(",")
  results.write($jentry)
  inc entries

proc open*() =
  thisMachine = getMachine()
  thisCommit = getCommit()

proc close*() =
  if currentCategory.len > 0:
    results.writeLine("]")
    close(results)