Changeset 6d5da743 in mainline


Ignore:
Timestamp:
2014-04-25T08:10:14Z (10 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d815b74, fef725d
Parents:
7cd15b9 (diff), 723ce99 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged random-configuration checking script + few fixes

The main Makefile has a new target - random-config - that generates
a random (but valid) configuration. This is useful for testing non-
default configurations.

The contrib/tools/random_check.sh script then further automates this
process by building random configurations multiple times.

This merge also includes several minor changes that fixed some of
the problems discovered by usage of the above mentioned script.

For the record, following configurations still do not build
(assuming the default platform profile with these alterations):

  • ARM 32 - Raspberry Pi
    • without the PL011 UART
    • with framebuffer support but without support of the BCM2835 (this looks like a nonsense configuration that shall be prohibited by the configuration script itself)
  • ARM 32 - GTA-02
    • without the S3C24 UART
  • ARM 32 - Integrator/CP
    • without PC keyboard
  • PowerPC 32
    • with link-time-optimization and -Os
  • IA 32
    • when all the dynamic-linking stuff is enabled

[Merged from lp:~vojtech-horky/helenos/misc]

Files:
1 added
20 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r7cd15b9 r6d5da743  
    9191        $(CONFIG) $<
    9292
     93random-config: $(CONFIG_RULES)
     94        $(CONFIG) $< random
     95
    9396# Release files
    9497
  • kernel/arch/mips32/src/debugger.c

    r7cd15b9 r6d5da743  
    9797        .argv = adde_argv
    9898};
     99#endif
    99100
    100101static struct {
     
    147148}
    148149
     150#ifdef CONFIG_KCONSOLE
     151
    149152/** Add new breakpoint to table
    150153 *
  • kernel/arch/sparc64/src/drivers/kbd.c

    r7cd15b9 r6d5da743  
    9090        size_t size = ((ofw_ebus_reg_t *) prop->value)->size;
    9191       
    92         uintptr_t pa;
     92        uintptr_t pa = 0; // Prevent -Werror=maybe-uninitialized
    9393        if (!ofw_ebus_apply_ranges(node->parent,
    9494            ((ofw_ebus_reg_t *) prop->value), &pa)) {
  • kernel/arch/sparc64/src/smp/sun4v/smp.c

    r7cd15b9 r6d5da743  
    263263                while (md_next_child(&it)) {
    264264                        md_node_t child = md_get_child_node(it);
    265                         const char *exec_unit_type;
     265                        const char *exec_unit_type = "";
    266266                        md_get_string_property(child, "type", &exec_unit_type);
    267267
  • kernel/genarch/include/genarch/softint/division.h

    r7cd15b9 r6d5da743  
    3636#define KERN_DIVISION_H_
    3737
     38#include <cc.h>
     39
     40#ifdef CONFIG_LTO
     41#define DO_NOT_DISCARD ATTRIBUTE_USED
     42#else
     43#define DO_NOT_DISCARD
     44#endif
     45
    3846extern int __divsi3(int, int);
    3947extern long long __divdi3(long long, long long);
    4048
    4149extern unsigned int __udivsi3(unsigned int, unsigned int);
    42 extern unsigned long long __udivdi3(unsigned long long, unsigned long long);
     50extern unsigned long long __udivdi3(unsigned long long, unsigned long long) DO_NOT_DISCARD;
    4351
    4452extern int __modsi3(int, int);
     
    4654
    4755extern unsigned int __umodsi3(unsigned int, unsigned int);
    48 extern unsigned long long __umoddi3(unsigned long long, unsigned long long);
     56extern unsigned long long __umoddi3(unsigned long long, unsigned long long) DO_NOT_DISCARD;
    4957
    5058extern int __divmodsi3(int, int, int *);
  • kernel/generic/include/cc.h

    r7cd15b9 r6d5da743  
    4040#define ATTRIBUTE_OPTIMIZE(opt) \
    4141        __attribute__ ((optimize(opt)))
     42#define ATTRIBUTE_USED \
     43        __attribute__ ((used))
    4244#else
    4345#define ATTRIBUTE_OPTIMIZE(opt)
     46#define ATTRIBUTE_USED
    4447#endif
    4548
  • kernel/generic/include/debug.h

    r7cd15b9 r6d5da743  
    3737
    3838#include <panic.h>
     39#include <log.h>
    3940#include <symtab_lookup.h>
    4041
  • kernel/generic/include/lib/memfnc.h

    r7cd15b9 r6d5da743  
    3939#include <cc.h>
    4040
     41#ifdef CONFIG_LTO
     42#define DO_NOT_DISCARD ATTRIBUTE_USED
     43#else
     44#define DO_NOT_DISCARD
     45#endif
     46
    4147extern void *memset(void *, int, size_t)
    42     ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns");
     48    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns") DO_NOT_DISCARD;
    4349extern void *memcpy(void *, const void *, size_t)
    44     ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns");
     50    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns") DO_NOT_DISCARD;
    4551
    4652#endif
  • kernel/generic/include/memstr.h

    r7cd15b9 r6d5da743  
    3737
    3838#include <typedefs.h>
     39#include <cc.h>
     40
     41#ifdef CONFIG_LTO
     42#define DO_NOT_DISCARD ATTRIBUTE_USED
     43#else
     44#define DO_NOT_DISCARD
     45#endif
    3946
    4047#define memset(dst, val, cnt)  __builtin_memset((dst), (val), (cnt))
     
    4350extern void memsetb(void *, size_t, uint8_t);
    4451extern void memsetw(void *, size_t, uint16_t);
    45 extern void *memmove(void *, const void *, size_t);
     52extern void *memmove(void *, const void *, size_t) DO_NOT_DISCARD;
    4653
    4754#endif
  • kernel/generic/src/console/cmd.c

    r7cd15b9 r6d5da743  
    11491149int cmd_set4(cmd_arg_t *argv)
    11501150{
    1151         uintptr_t addr;
     1151        uintptr_t addr = 0; // Prevent -Werror=maybe-uninitialized
    11521152        uint32_t arg1 = argv[1].intval;
    11531153        bool pointer = false;
  • kernel/generic/src/mm/as.c

    r7cd15b9 r6d5da743  
    17251725        ASSERT(count);
    17261726       
    1727         btree_node_t *leaf;
     1727        btree_node_t *leaf = NULL;
    17281728        size_t pages = (size_t) btree_search(&area->used_space, page, &leaf);
    17291729        if (pages) {
     
    17331733                return false;
    17341734        }
     1735
     1736        ASSERT(leaf != NULL);
    17351737       
    17361738        if (!leaf->keys) {
  • kernel/generic/src/mm/frame.c

    r7cd15b9 r6d5da743  
    391391       
    392392        /* Allocate frames from zone */
    393         size_t index;
     393        size_t index = (size_t) -1;
    394394        int avail = bitmap_allocate_range(&zone->bitmap, count, zone->base,
    395395            FRAME_LOWPRIO, constraint, &index);
    396396       
    397397        ASSERT(avail);
     398        ASSERT(index != (size_t) -1);
    398399       
    399400        /* Update frame reference count */
  • kernel/generic/src/udebug/udebug_ipc.c

    r7cd15b9 r6d5da743  
    343343        sysarg_t uspace_addr;
    344344        sysarg_t to_copy;
    345         void *buffer;
     345        void *buffer = NULL;
    346346        int rc;
    347347
     
    354354                return;
    355355        }
     356
     357        ASSERT(buffer != NULL);
    356358
    357359        /*
     
    385387        sysarg_t uspace_src;
    386388        unsigned size;
    387         void *buffer;
     389        void *buffer = NULL;
    388390        int rc;
    389391
     
    398400                return;
    399401        }
     402
     403        ASSERT(buffer != NULL);
    400404
    401405        IPC_SET_RETVAL(call->data, 0);
  • tools/config.py

    r7cd15b9 r6d5da743  
    4040import subprocess
    4141import xtui
     42import random
    4243
    4344RULES_FILE = sys.argv[1]
     
    256257       
    257258        return True
     259
     260## Fill the configuration with random (but valid) values.
     261#
     262# The random selection takes next rule and if the condition does
     263# not violate existing configuration, random value of the variable
     264# is selected.
     265# This happens recursively as long as there are more rules.
     266# If a conflict is found, we backtrack and try other settings of the
     267# variable or ignoring the variable altogether.
     268#
     269# @param config Configuration to work on
     270# @param rules  Rules
     271# @param start_index With which rule to start (initial call must specify 0 here).
     272# @return True if able to find a valid configuration
     273def random_choices(config, rules, start_index):
     274        "Fill the configuration with random (but valid) values."
     275        if start_index >= len(rules):
     276                return True
     277       
     278        varname, vartype, name, choices, cond = rules[start_index]
     279
     280        # First check that this rule would make sense   
     281        if cond:
     282                if not check_condition(cond, config, rules):
     283                        return random_choices(config, rules, start_index + 1)
     284       
     285        # Remember previous choices for backtracking
     286        yes_no = 0
     287        choices_indexes = range(0, len(choices))
     288        random.shuffle(choices_indexes)
     289       
     290        # Remember current configuration value
     291        old_value = None
     292        try:
     293                old_value = config[varname]
     294        except KeyError:
     295                old_value = None
     296       
     297        # For yes/no choices, we ran the loop at most 2 times, for select
     298        # choices as many times as there are options.
     299        try_counter = 0
     300        while True:
     301                if vartype == 'choice':
     302                        if try_counter >= len(choices_indexes):
     303                                break
     304                        value = choices[choices_indexes[try_counter]][0]
     305                elif vartype == 'y' or vartype == 'n':
     306                        if try_counter > 0:
     307                                break
     308                        value = vartype
     309                elif vartype == 'y/n' or vartype == 'n/y':
     310                        if try_counter == 0:
     311                                yes_no = random.randint(0, 1)
     312                        elif try_counter == 1:
     313                                yes_no = 1 - yes_no
     314                        else:
     315                                break
     316                        if yes_no == 0:
     317                                value = 'n'
     318                        else:
     319                                value = 'y'
     320                else:
     321                        raise RuntimeError("Unknown variable type: %s" % vartype)
     322       
     323                config[varname] = value
     324               
     325                ok = random_choices(config, rules, start_index + 1)
     326                if ok:
     327                        return True
     328               
     329                try_counter = try_counter + 1
     330       
     331        # Restore the old value and backtrack
     332        # (need to delete to prevent "ghost" variables that do not exist under
     333        # certain configurations)
     334        config[varname] = old_value
     335        if old_value is None:
     336                del config[varname]
     337       
     338        return random_choices(config, rules, start_index + 1)
     339       
    258340
    259341## Get default value from a rule.
     
    555637                return 1
    556638       
     639        # Random mode
     640        if (len(sys.argv) == 3) and (sys.argv[2] == 'random'):
     641                ok = random_choices(config, rules, 0)
     642                if not ok:
     643                        sys.stderr.write("Internal error: unable to generate random config.\n")
     644                        return 2
     645                if not infer_verify_choices(config, rules):
     646                        sys.stderr.write("Internal error: random configuration not consistent.\n")
     647                        return 2
     648                preprocess_config(config, rules)
     649                create_output(MAKEFILE, MACROS, config, rules)
     650               
     651                return 0       
     652       
    557653        screen = xtui.screen_init()
    558654        try:
  • uspace/drv/bus/pci/pciintel/pci.c

    r7cd15b9 r6d5da743  
    284284        const uint32_t conf_addr = CONF_ADDR(fun->bus, fun->dev, fun->fn, reg);
    285285        pci_bus_t *bus = pci_bus_from_fun(fun);
    286         uint32_t val;
     286        uint32_t val = 0; // Prevent -Werror=maybe-uninitialized
    287287       
    288288        fibril_mutex_lock(&bus->conf_mutex);
  • uspace/lib/softint/generic/shift.c

    r7cd15b9 r6d5da743  
    128128}
    129129
     130long long __aeabi_llsr(long long val, int shift)
     131{
     132        return __lshrdi3(val, shift);
     133}
     134
    130135/** @}
    131136 */
  • uspace/lib/softint/include/shift.h

    r7cd15b9 r6d5da743  
    4949/* ARM EABI */
    5050extern long long __aeabi_llsl(long long, int);
     51extern long long __aeabi_llsr(long long, int);
    5152
    5253#endif
  • uspace/srv/net/dhcp/transport.c

    r7cd15b9 r6d5da743  
    172172        dhcp_transport_t *dt = (dhcp_transport_t *)arg;
    173173        void *msg;
    174         size_t size;
     174        size_t size = (size_t) -1;
    175175        int rc;
    176176
     
    179179                if (rc != EOK)
    180180                        break;
     181
     182                assert(size != (size_t) -1);
    181183
    182184                dt->recv_cb(dt->cb_arg, msg, size);
  • uspace/srv/net/dnsrsrv/dns_msg.c

    r7cd15b9 r6d5da743  
    487487        size_t size;
    488488        dns_header_t hdr;
    489         size_t q_size;
     489        size_t q_size = 0;
    490490        size_t di;
    491491        int rc;
     
    515515                        return rc;
    516516
     517                assert(q_size > 0);
     518
    517519                size += q_size;
    518520        }
     
    532534                        return rc;
    533535                }
     536
     537                assert(q_size > 0);
    534538
    535539                di += q_size;
  • uspace/srv/net/dnsrsrv/transport.c

    r7cd15b9 r6d5da743  
    286286static int transport_recv_fibril(void *arg)
    287287{
    288         dns_message_t *resp;
     288        dns_message_t *resp = NULL;
    289289        trans_req_t *treq;
    290290        int rc;
     
    294294                if (rc != EOK)
    295295                        continue;
     296
     297                assert(resp != NULL);
    296298
    297299                fibril_mutex_lock(&treq_lock);
Note: See TracChangeset for help on using the changeset viewer.